]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify open_file()
authorVolker Lendecke <vl@samba.org>
Tue, 5 Sep 2023 12:46:21 +0000 (14:46 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 5 Oct 2023 12:58:33 +0000 (12:58 +0000)
We can unconditionally just and-out O_CREAT from local_flags, so
remove an if-condition.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/open.c

index efcd0ceec8ef999945d313f720c03caf4e2a09d2..3b7236b8895b25f8d4ae630ba6e978fd043febdd 100644 (file)
@@ -1355,13 +1355,12 @@ static NTSTATUS open_file(struct smb_request *req,
                                 smb_fname_str_dbg(smb_fname)));
                        return NT_STATUS_ACCESS_DENIED;
                }
-               if (flags & O_CREAT) {
-                       /* We don't want to write - but we must make sure that
-                          O_CREAT doesn't create the file if we have write
-                          access into the directory.
-                       */
-                       local_flags &= ~(O_CREAT|O_EXCL);
-               }
+               /*
+                * We don't want to write - but we must make sure that
+                * O_CREAT doesn't create the file if we have write
+                * access into the directory.
+                */
+               local_flags &= ~(O_CREAT | O_EXCL);
        }
 
        /*