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:
CismonX 2025-07-06 11:29:55 +08:00
parent f9940400bb
commit d911439ca3
No known key found for this signature in database
GPG key ID: 3094873E29A482FB

View file

@ -63,11 +63,13 @@ xattr_do_get (
#if defined(__linux__)
result = fgetxattr(fd, name, buf, buf_len);
if (result < 0) {
result = -errno;
log_printf("fgetxattr(): %s", strerror(errno));
}
#elif defined(__FreeBSD__)
result = extattr_get_fd(fd, EXTATTR_NAMESPACE_USER, name, buf, buf_len);
if (result < 0) {
result = -errno;
log_printf("extattr_get_fd(): %s", strerror(errno));
}
#else
@ -86,11 +88,13 @@ xattr_do_list (
#if defined(__linux__)
result = flistxattr(fd, buf, buf_len);
if (result < 0) {
result = -errno;
log_printf("flistxattr(): %s", strerror(errno));
}
#elif defined(__FreeBSD__)
result = extattr_list_fd(fd, EXTATTR_NAMESPACE_USER, buf, buf_len);
if (result < 0) {
result = -errno;
log_printf("extattr_list_fd(): %s", strerror(errno));
}
#else