]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify an if-condition in open_file()
authorVolker Lendecke <vl@samba.org>
Tue, 5 Sep 2023 12:50:05 +0000 (14:50 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 5 Oct 2023 12:58:33 +0000 (12:58 +0000)
We use the plain (flags&O_TRUNC) a few lines above, make the
if-condition a bit more readable.

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

index 3b7236b8895b25f8d4ae630ba6e978fd043febdd..ba1341de0d788c20fad4e72bf7f8a6f3fd3bd73d 100644 (file)
@@ -1375,8 +1375,7 @@ static NTSTATUS open_file(struct smb_request *req,
         * as we always opened files read-write in that release. JRA.
         */
 
-       if (((flags & O_ACCMODE) == O_RDONLY) &&
-           ((flags & O_TRUNC) == O_TRUNC)) {
+       if (((flags & O_ACCMODE) == O_RDONLY) && (flags & O_TRUNC)) {
                DEBUG(10,("open_file: truncate requested on read-only open "
                          "for file %s\n", smb_fname_str_dbg(smb_fname)));
                local_flags = (flags & ~O_ACCMODE)|O_RDWR;