From: Jeremy Allison Date: Thu, 17 May 2018 17:33:38 +0000 (-0700) Subject: s3: smbd: optimization. Only do the FCHMOD call if needed. X-Git-Tag: ldb-1.4.0~56 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4f6c71ae886f65c120e628403e24970f0d126fc5;p=thirdparty%2Fsamba.git s3: smbd: optimization. Only do the FCHMOD call if needed. Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 7763a095733..99e0e0462e3 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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); + } } }