From: Jeremy Allison Date: Thu, 17 Jun 2021 19:23:46 +0000 (-0700) Subject: s3: VFS: syncops: Do early returns in SYNCOPS_NEXT_SMB_FNAME() macro. X-Git-Tag: tevent-0.11.0~234 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5da0d75dd47e2e4e44663fc75b0b7df27b261ee8;p=thirdparty%2Fsamba.git s3: VFS: syncops: Do early returns in SYNCOPS_NEXT_SMB_FNAME() macro. Makes the macro much clearer. We should always do the operation first, then try the sync. Failure to sync is not reported as an error, so failure to create the full_fname shouldn't fail the operation either. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- diff --git a/source3/modules/vfs_syncops.c b/source3/modules/vfs_syncops.c index c0ef4c3b81e..feb9dde2615 100644 --- a/source3/modules/vfs_syncops.c +++ b/source3/modules/vfs_syncops.c @@ -170,16 +170,23 @@ static int syncops_renameat(vfs_handle_struct *handle, SMB_VFS_HANDLE_GET_DATA(handle, config, \ struct syncops_config_data, \ return -1); \ + ret = SMB_VFS_NEXT_ ## op args; \ + if (ret != 0) { \ + return ret; \ + } \ + if (config->disable) { \ + return ret; \ + } \ + if (!config->onmeta) { \ + return ret; \ + } \ full_fname = full_path_from_dirfsp_atname(talloc_tos(), \ dirfsp, \ smb_fname); \ if (full_fname == NULL) { \ - return -1; \ + return ret; \ } \ - ret = SMB_VFS_NEXT_ ## op args; \ - if (ret == 0 \ - && config->onmeta && !config->disable \ - && fname) syncops_smb_fname(dirfsp->conn, full_fname); \ + syncops_smb_fname(dirfsp->conn, full_fname); \ TALLOC_FREE(full_fname); \ return ret; \ } while (0)