diff --git a/sys/compat/linux/linux_xattr.c b/sys/compat/linux/linux_xattr.c index b54a0d2f89ad..ab7f8db79b80 100644 --- a/sys/compat/linux/linux_xattr.c +++ b/sys/compat/linux/linux_xattr.c @@ -71,6 +71,13 @@ struct setxattr_args { static char *extattr_namespace_names[] = EXTATTR_NAMESPACE_NAMES; +static int +error_to_xattrerror(int error) +{ + + return (error == EPERM ? ENOTSUP : error); +} + static int xatrr_to_extattr(const char *uattrname, int *attrnamespace, char *attrname) { @@ -172,7 +179,7 @@ listxattr(struct thread *td, struct listxattr_args *args) if (error == 0) td->td_retval[0] = cnt; free(data, M_LINUX); - return (error); + return (error_to_xattrerror(error)); } int @@ -228,8 +235,9 @@ linux_path_removexattr(struct thread *td, const char *upath, const char *uname, if (error != 0) return (error); - return (kern_extattr_delete_path(td, upath, attrnamespace, - attrname, follow, UIO_USERSPACE)); + error = kern_extattr_delete_path(td, upath, attrnamespace, + attrname, follow, UIO_USERSPACE); + return (error_to_xattrerror(error)); } int @@ -257,8 +265,8 @@ linux_fremovexattr(struct thread *td, struct linux_fremovexattr_args *args) error = xatrr_to_extattr(args->name, &attrnamespace, attrname); if (error != 0) return (error); - return (kern_extattr_delete_fd(td, args->fd, attrnamespace, - attrname)); + error = kern_extattr_delete_fd(td, args->fd, attrnamespace, attrname); + return (error_to_xattrerror(error)); } static int @@ -272,8 +280,9 @@ linux_path_getxattr(struct thread *td, const char *upath, const char *uname, if (error != 0) return (error); - return (kern_extattr_get_path(td, upath, attrnamespace, - attrname, value, size, follow, UIO_USERSPACE)); + error = kern_extattr_get_path(td, upath, attrnamespace, + attrname, value, size, follow, UIO_USERSPACE); + return (error_to_xattrerror(error)); } int @@ -301,8 +310,9 @@ linux_fgetxattr(struct thread *td, struct linux_fgetxattr_args *args) error = xatrr_to_extattr(args->name, &attrnamespace, attrname); if (error != 0) return (error); - return (kern_extattr_get_fd(td, args->fd, attrnamespace, - attrname, args->value, args->size)); + error = kern_extattr_get_fd(td, args->fd, attrnamespace, + attrname, args->value, args->size); + return (error_to_xattrerror(error)); } static int @@ -344,7 +354,7 @@ setxattr(struct thread *td, struct setxattr_args *args) attrname, args->value, args->size); out: td->td_retval[0] = 0; - return (error); + return (error_to_xattrerror(error)); } int