From fec8505e0be067a09929216cfe476802f21d14fe Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 29 Jul 2010 17:04:18 +0200 Subject: 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 55ea8960de..ba1fbf227c 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.. -- cgit