From a86e338a048ea70af850e24956f4c461143f336a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 29 Jul 2010 17:04:18 +0200 Subject: [PATCH] s3: Avoid an unnecessary ftruncate call If we just created the file, it has length 0 by definition. This is still done while holding the share mode lock, so no race around wrt other cifs clients. --- source3/smbd/open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 55ea8960de9..ba1fbf227c7 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2142,7 +2142,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, * If requested, truncate the file. */ - if (flags2&O_TRUNC) { + if (file_existed && (flags2&O_TRUNC)) { /* * We are modifing the file after open - update the stat * struct.. -- 2.11.4.GIT