From 2f4e581c3d103633c96cdec35b0a9e7c9d2ae042 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 17 May 2018 10:35:58 -0700 Subject: [PATCH] s3: smbd: Optimization. Only do the FCHMOD_ACL call if mode bits not equal. Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- source3/smbd/open.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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) { -- 2.47.2