From: Jeremy Allison Date: Thu, 17 May 2018 17:35:58 +0000 (-0700) Subject: s3: smbd: Optimization. Only do the FCHMOD_ACL call if mode bits not equal. X-Git-Tag: ldb-1.4.0~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f4e581c3d103633c96cdec35b0a9e7c9d2ae042;p=thirdparty%2Fsamba.git s3: smbd: Optimization. Only do the FCHMOD_ACL call if mode bits not equal. Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 99e0e0462e3..e98936559f8 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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) {