s3-vfs: Use ENOATTR in errno comparison for getxattr
authorAnoop C S <anoopcs@redhat.com>
Wed, 23 Jan 2019 10:10:43 +0000 (15:40 +0530)
committerJeremy Allison <jra@samba.org>
Wed, 23 Jan 2019 20:59:10 +0000 (21:59 +0100)
* ENODATA is not defined in FreeBSD
* ENOATTR is defined to be a synonym for ENODATA in Linux
* In its absence Samba already defines ENOATTR to either
  ENODATA or ENOENT

Thus it is safe and correct to compare with ENOATTR rather
than ENODATA.

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jan 23 21:59:10 CET 2019 on sn-devel-144

source3/modules/posixacl_xattr.c
source3/modules/vfs_glusterfs.c
source3/modules/vfs_glusterfs_fuse.c

index 8f6f365bff969e0bfda384d7451042dc1c6260ea..6f016e17e0b655a55b79c27ad953c834fe4c5715 100644 (file)
@@ -379,7 +379,7 @@ SMB_ACL_T posixacl_xattr_acl_get_file(vfs_handle_struct *handle,
        if (ret > 0) {
                return posixacl_xattr_to_smb_acl(buf, ret, mem_ctx);
        }
-       if (ret == 0 || errno == ENOATTR || errno == ENODATA) {
+       if (ret == 0 || errno == ENOATTR) {
                mode_t mode = 0;
                TALLOC_CTX *frame = talloc_stackframe();
                struct smb_filename *smb_fname_tmp =
@@ -434,7 +434,7 @@ SMB_ACL_T posixacl_xattr_acl_get_fd(vfs_handle_struct *handle,
        if (ret > 0) {
                return posixacl_xattr_to_smb_acl(buf, ret, mem_ctx);
        }
-       if (ret == 0 || errno == ENOATTR || errno == ENODATA) {
+       if (ret == 0 || errno == ENOATTR) {
                SMB_STRUCT_STAT sbuf;
                ret = SMB_VFS_FSTAT(fsp, &sbuf);
                if (ret == 0)
index c9d57b4b64632260aa7f1bda9599a62b335c0450..a241ac9db9ff7a036c01b577f7843f42482d6db5 100644 (file)
@@ -1443,7 +1443,7 @@ static int vfs_gluster_get_real_filename(struct vfs_handle_struct *handle,
 
        ret = glfs_getxattr(handle->data, path, key_buf, val_buf, NAME_MAX + 1);
        if (ret == -1) {
-               if (errno == ENODATA) {
+               if (errno == ENOATTR) {
                        errno = EOPNOTSUPP;
                }
                return -1;
index 64c1b0035c1380eecbafc11195511ab86be7ec4a..8855cd18d0192b3cef43fcf5f2775cf638c38bd9 100644 (file)
@@ -42,7 +42,7 @@ static int vfs_gluster_fuse_get_real_filename(struct vfs_handle_struct *handle,
 
        ret = getxattr(path, key_buf, val_buf, NAME_MAX + 1);
        if (ret == -1) {
-               if (errno == ENODATA) {
+               if (errno == ENOATTR) {
                        errno = EOPNOTSUPP;
                }
                return -1;