s3: Make open_file_ntcreate a bit easier to read
authorVolker Lendecke <vl@samba.org>
Thu, 15 Dec 2011 15:30:08 +0000 (16:30 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 16 Dec 2011 06:34:48 +0000 (07:34 +0100)
Move the calculation of "new_file_created" closer to its use

source3/smbd/open.c

index 4ea51dd4e9a46e04ef6094bebbc254adaa9a9159..17d9f6f8fb69cce4bf69abe3a6880365d4a71857 100644 (file)
@@ -2402,10 +2402,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                fsp->oplock_type = NO_OPLOCK;
        }
 
-       if (info == FILE_WAS_OVERWRITTEN || info == FILE_WAS_CREATED || info == FILE_WAS_SUPERSEDED) {
-               new_file_created = True;
-       }
-
        set_share_mode(lck, fsp, get_current_uid(conn),
                        req ? req->mid : 0,
                       fsp->oplock_type);
@@ -2427,6 +2423,12 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                fsp->initial_delete_on_close = True;
        }
 
+       if (info == FILE_WAS_OVERWRITTEN
+           || info == FILE_WAS_CREATED
+           || info == FILE_WAS_SUPERSEDED) {
+               new_file_created = True;
+       }
+
        if (new_file_created) {
                /* Files should be initially set as archive */
                if (lp_map_archive(SNUM(conn)) ||