From: Anoop C S Date: Wed, 23 Jan 2019 10:10:43 +0000 (+0530) Subject: s3-vfs: Use ENOATTR in errno comparison for getxattr X-Git-Url: http://git.samba.org/samba.git/?p=amitay%2Fsamba.git;a=commitdiff_plain;h=c99402724a65f4e1f8ed4dcd236a43e0603bef0a s3-vfs: Use ENOATTR in errno comparison for getxattr * 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 Reviewed-by: Uri Simchoni Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Jan 23 21:59:10 CET 2019 on sn-devel-144 --- diff --git a/source3/modules/posixacl_xattr.c b/source3/modules/posixacl_xattr.c index 8f6f365bff9..6f016e17e0b 100644 --- a/source3/modules/posixacl_xattr.c +++ b/source3/modules/posixacl_xattr.c @@ -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) diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index c9d57b4b646..a241ac9db9f 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -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; diff --git a/source3/modules/vfs_glusterfs_fuse.c b/source3/modules/vfs_glusterfs_fuse.c index 64c1b0035c1..8855cd18d01 100644 --- a/source3/modules/vfs_glusterfs_fuse.c +++ b/source3/modules/vfs_glusterfs_fuse.c @@ -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;