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)
committerKarolin Seeger <kseeger@samba.org>
Tue, 5 Feb 2019 22:59:06 +0000 (23: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.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13774

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

(cherry picked from commit c99402724a65f4e1f8ed4dcd236a43e0603bef0a)

Autobuild-User(v4-10-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-10-test): Tue Feb  5 23:59:06 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 a5d93ab52512970b08f25be8c8f4125aeab4d152..601be5a2da46d6007c5b472979f6df1841d5c730 100644 (file)
@@ -1462,7 +1462,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;