]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: syncops: Do early returns in SYNCOPS_NEXT_SMB_FNAME() macro.
authorJeremy Allison <jra@samba.org>
Thu, 17 Jun 2021 19:23:46 +0000 (12:23 -0700)
committerNoel Power <npower@samba.org>
Tue, 22 Jun 2021 13:44:34 +0000 (13:44 +0000)
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 <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/modules/vfs_syncops.c

index c0ef4c3b81e42a9e0e5c5ca4889360ffc53b77d2..feb9dde2615111587d4c3851db9c13499c70abc1 100644 (file)
@@ -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)