]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: optimization. Only do the FCHMOD call if needed.
authorJeremy Allison <jra@samba.org>
Thu, 17 May 2018 17:33:38 +0000 (10:33 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 25 May 2018 16:39:24 +0000 (18:39 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/open.c

index 7763a09573396c5150dcfa09f5bf59d60c8b6d24..99e0e0462e3c2c1881d75f81e921d179ffccf134 100644 (file)
@@ -3806,12 +3806,14 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                 * an overwritten file.
                 */
 
-               int ret = SMB_VFS_FCHMOD(fsp, new_unx_mode);
-               if (ret == -1) {
-                       DBG_INFO("failed to reset "
+               if (new_unx_mode != smb_fname->st.st_ex_mode) {
+                       int ret = SMB_VFS_FCHMOD(fsp, new_unx_mode);
+                       if (ret == -1) {
+                               DBG_INFO("failed to reset "
                                  "attributes of file %s to 0%o\n",
                                  smb_fname_str_dbg(smb_fname),
                                  (unsigned int)new_unx_mode);
+                       }
                }
        }