From: Volker Lendecke Date: Sun, 2 Feb 2025 15:44:53 +0000 (+0100) Subject: vfs: Simplify fruit_unlink_rsrc_stream() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=982f0145114f0e21a8dd9451663e2d55c8adb21c;p=thirdparty%2Fsamba.git vfs: Simplify fruit_unlink_rsrc_stream() We have the dirfsp around, no need to do a full stat() Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 6f12c3c5d3e..b274274d46c 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -2081,19 +2081,7 @@ static int fruit_unlink_rsrc_stream(vfs_handle_struct *handle, int ret; if (!force_unlink) { - struct smb_filename *full_fname = NULL; - off_t size; - - /* - * TODO: use SMB_VFS_STATX() once we have it. - */ - - full_fname = full_path_from_dirfsp_atname(talloc_tos(), - dirfsp, - smb_fname); - if (full_fname == NULL) { - return -1; - } + struct stat_ex st = {}; /* * 0 byte resource fork streams are not listed by @@ -2101,18 +2089,17 @@ static int fruit_unlink_rsrc_stream(vfs_handle_struct *handle, * deletion doesn't remove the resourcefork stream. */ - ret = SMB_VFS_NEXT_STAT(handle, full_fname); + ret = SMB_VFS_NEXT_FSTATAT( + handle, dirfsp, smb_fname, &st, AT_SYMLINK_NOFOLLOW); if (ret != 0) { - TALLOC_FREE(full_fname); - DBG_ERR("stat [%s] failed [%s]\n", - smb_fname_str_dbg(full_fname), strerror(errno)); + DBG_ERR("fstatat [%s%s] failed [%s]\n", + dirfsp->fsp_name->base_name, + smb_fname->base_name, + strerror(errno)); return -1; } - size = full_fname->st.st_ex_size; - TALLOC_FREE(full_fname); - - if (size > 0) { + if (st.st_ex_size > 0) { /* OS X ignores resource fork stream delete requests */ return 0; }