mirror of
https://git.sr.ht/~cismonx/bookmarkfs
synced 2025-07-25 10:38:56 +00:00
xattr: fix xattr_do_get/xattr_do_list return value
The functions should return negated errno on failure, since bookmarkfs_xattr_get() and bookmarkfs_xattr_list() check whether the syscall fails with ERANGE.
This commit is contained in:
parent
f9940400bb
commit
d911439ca3
1 changed files with 4 additions and 0 deletions
|
@ -63,11 +63,13 @@ xattr_do_get (
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
result = fgetxattr(fd, name, buf, buf_len);
|
result = fgetxattr(fd, name, buf, buf_len);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
result = -errno;
|
||||||
log_printf("fgetxattr(): %s", strerror(errno));
|
log_printf("fgetxattr(): %s", strerror(errno));
|
||||||
}
|
}
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
result = extattr_get_fd(fd, EXTATTR_NAMESPACE_USER, name, buf, buf_len);
|
result = extattr_get_fd(fd, EXTATTR_NAMESPACE_USER, name, buf, buf_len);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
result = -errno;
|
||||||
log_printf("extattr_get_fd(): %s", strerror(errno));
|
log_printf("extattr_get_fd(): %s", strerror(errno));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -86,11 +88,13 @@ xattr_do_list (
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
result = flistxattr(fd, buf, buf_len);
|
result = flistxattr(fd, buf, buf_len);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
result = -errno;
|
||||||
log_printf("flistxattr(): %s", strerror(errno));
|
log_printf("flistxattr(): %s", strerror(errno));
|
||||||
}
|
}
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
result = extattr_list_fd(fd, EXTATTR_NAMESPACE_USER, buf, buf_len);
|
result = extattr_list_fd(fd, EXTATTR_NAMESPACE_USER, buf, buf_len);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
result = -errno;
|
||||||
log_printf("extattr_list_fd(): %s", strerror(errno));
|
log_printf("extattr_list_fd(): %s", strerror(errno));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Reference in a new issue