From 264694c94c545723f4cae3d11c77fd4311a2aa59 Mon Sep 17 00:00:00 2001 From: "Jose A. Rivera" Date: Tue, 19 Jan 2016 14:32:21 -0600 Subject: [PATCH] s3:smbd:open: Skip redundant call to file_set_dosmode when creating a new file. Signed-off-by: Jose A. Rivera Pair-programmed-with: Ira Cooper Reviewed-by: Jeremy Allison --- source3/smbd/open.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 3c0a7a3..b654fad 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3168,8 +3168,14 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, fsp->initial_delete_on_close = True; } - if (info != FILE_WAS_OPENED) { - /* Files should be initially set as archive */ + /* + * All new files should initially have the DOS archive bit set. This + * is already taken care of for created files (and does not apply to + * normally opened files), but overwritten files still carry the DOS + * attributes of the old file. Thus, we should make sure the archive + * bit is set. + */ + if (info == FILE_WAS_OVERWRITTEN) { if (lp_map_archive(SNUM(conn)) || lp_store_dos_attributes(SNUM(conn))) { if (!posix_open) { -- 2.5.0