X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=binary_storage.c;h=c782d8672123924ac72d155614c716f8c8faacb2;hb=44ba89e4e046391df5001e48b9469f7c0ef254f7;hp=5e8743619744b6cfbf4c787cef51f545241f9509;hpb=6ca245e1d26401609f4811e90ffed40a09cb51bd;p=rrq%2Ffuse_xattrs.git diff --git a/binary_storage.c b/binary_storage.c index 5e87436..c782d86 100644 --- a/binary_storage.c +++ b/binary_storage.c @@ -17,7 +17,11 @@ #include "utils.h" #include "fuse_xattrs_config.h" -#include +#include + +#ifndef ENOATTR + #define ENOATTR ENODATA +#endif struct on_memory_attr { u_int16_t name_size; @@ -197,7 +201,7 @@ int __write_to_file(FILE *file, const char *name, const char *value, const size_ #ifdef DEBUG char *sanitized_value = sanitize_value(value, value_size); - debug_print("name='%s' name_size=%zu sanitized_value='%s' value_size=%zu\n", name, name_size, sanitized_value, value_size); + debug_print("name='%s' name_size=%hu sanitized_value='%s' value_size=%zu\n", name, name_size, sanitized_value, value_size); free(sanitized_value); #endif @@ -230,7 +234,7 @@ int __write_to_file(FILE *file, const char *name, const char *value, const size_ * @param value - attribute value. size < XATTR_SIZE_MAX * @param size * @param flags - XATTR_CREATE and/or XATTR_REPLACE - * @return On success, zero is returned. On failure, -errno is returnted. + * @return On success, zero is returned. On failure, -errno is returned. */ int binary_storage_write_key(const char *path, const char *name, const char *value, size_t size, int flags) { @@ -245,7 +249,7 @@ int binary_storage_write_key(const char *path, const char *name, const char *val if (buffer == NULL && buffer_size == -ENOENT && flags & XATTR_REPLACE) { error_print("No xattr. (flag XATTR_REPLACE)"); - return -ENODATA; + return -ENOATTR; } if (buffer == NULL && buffer_size != -ENOENT) { @@ -415,7 +419,7 @@ int binary_storage_list_keys(const char *path, char *list, size_t size) if (size == 0 && res > XATTR_LIST_MAX) { // FIXME: we should return the size or an error ? - return -E2BIG; + return -ENOSPC; } return (int)res; @@ -474,4 +478,4 @@ int binary_storage_remove_key(const char *path, const char *name) fclose(file); free(buffer); return res; -} \ No newline at end of file +}