summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-07-29 17:04:18 +0200
committerVolker Lendecke <vl@samba.org>2010-07-29 22:46:36 +0200
commitfec8505e0be067a09929216cfe476802f21d14fe (patch)
tree43c1187436fcb8a46464d1b24e30fac38917f187
parent4f4303048260ca19a5feef6b9338add1a19fb53c (diff)
downloadsamba-fec8505e0be067a09929216cfe476802f21d14fe.tar.gz
samba-fec8505e0be067a09929216cfe476802f21d14fe.tar.bz2
samba-fec8505e0be067a09929216cfe476802f21d14fe.zip
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.
-rw-r--r--source3/smbd/open.c2
1 files changed, 1 insertions, 1 deletions
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..