s3: smbd: Optimization. Only do the FCHMOD_ACL call if mode bits not equal.
authorJeremy Allison <jra@samba.org>
Thu, 17 May 2018 17:35:58 +0000 (10:35 -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 99e0e0462e3c2c1881d75f81e921d179ffccf134..e98936559f887ba99f272f475b460e222e4183fe 100644 (file)
@@ -3776,13 +3776,14 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
         */
 
        if (!posix_open && new_file_created && !def_acl) {
+               if (unx_mode != smb_fname->st.st_ex_mode) {
+                       /* We might get ENOSYS in the next call.. */
+                       int saved_errno = errno;
 
-               int saved_errno = errno; /* We might get ENOSYS in the next
-                                         * call.. */
-
-               if (SMB_VFS_FCHMOD_ACL(fsp, unx_mode) == -1 &&
-                   errno == ENOSYS) {
-                       errno = saved_errno; /* Ignore ENOSYS */
+                       if (SMB_VFS_FCHMOD_ACL(fsp, unx_mode) == -1 &&
+                           errno == ENOSYS) {
+                               errno = saved_errno; /* Ignore ENOSYS */
+                       }
                }
 
        } else if (new_unx_mode) {