From: Jeremy Allison Date: Wed, 14 Jul 2021 18:17:49 +0000 (-0700) Subject: s3: VFS: default: Move vfswrap_fgetxattr() before the async versions. X-Git-Tag: samba-4.15.0rc1~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0b327f2eb5781a119efde1a2450de4e6d2570e8;p=thirdparty%2Fsamba.git s3: VFS: default: Move vfswrap_fgetxattr() before the async versions. We want to re-use this and don't want to have to add forward declarations. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14758 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 102938e332e..e9bd2471556 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -3425,6 +3425,36 @@ static int vfswrap_sys_acl_delete_def_fd(vfs_handle_struct *handle, Extended attribute operations. *****************************************************************/ +static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, + struct files_struct *fsp, + const char *name, + void *value, + size_t size) +{ + int fd = fsp_get_pathref_fd(fsp); + + if (!fsp->fsp_flags.is_pathref) { + return fgetxattr(fd, name, value, size); + } + + if (fsp->fsp_flags.have_proc_fds) { + const char *p = NULL; + char buf[PATH_MAX]; + + p = sys_proc_fd_path(fd, buf, sizeof(buf)); + if (p == NULL) { + return -1; + } + + return getxattr(p, name, value, size); + } + + /* + * This is no longer a handle based call. + */ + return getxattr(fsp->fsp_name->base_name, name, value, size); +} + struct vfswrap_getxattrat_state { struct tevent_context *ev; files_struct *dir_fsp; @@ -3742,36 +3772,6 @@ static ssize_t vfswrap_getxattrat_recv(struct tevent_req *req, return xattr_size; } -static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, - struct files_struct *fsp, - const char *name, - void *value, - size_t size) -{ - int fd = fsp_get_pathref_fd(fsp); - - if (!fsp->fsp_flags.is_pathref) { - return fgetxattr(fd, name, value, size); - } - - if (fsp->fsp_flags.have_proc_fds) { - const char *p = NULL; - char buf[PATH_MAX]; - - p = sys_proc_fd_path(fd, buf, sizeof(buf)); - if (p == NULL) { - return -1; - } - - return getxattr(p, name, value, size); - } - - /* - * This is no longer a handle based call. - */ - return getxattr(fsp->fsp_name->base_name, name, value, size); -} - static ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) { int fd = fsp_get_pathref_fd(fsp);