r17131: Optimisation - when doing a stat open don't open the
authorJeremy Allison <jra@samba.org>
Wed, 19 Jul 2006 05:32:12 +0000 (05:32 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:38:14 +0000 (11:38 -0500)
file unless we really have to (ie. O_CREAT and file
doesn't exist).
Jeremy.
(This used to be commit 788aa15ea24e6dfb61820465b5b881829a64297a)

source3/smbd/open.c

index 53178956cdd0b195c91d7c388cd58e715a44ebb6..4033243888edad1054aaea3c9b8c4cc32d3ce250 100644 (file)
@@ -245,7 +245,7 @@ static NTSTATUS open_file(files_struct *fsp,
        }
 
        if ((access_mask & (FILE_READ_DATA|FILE_WRITE_DATA|FILE_APPEND_DATA|FILE_EXECUTE)) ||
-           (local_flags & O_CREAT) ||
+           (!file_existed && (local_flags & O_CREAT)) ||
            ((local_flags & O_TRUNC) == O_TRUNC) ) {
 
                /*