s3: Replace an if with a boolean short circuit
authorVolker Lendecke <vl@samba.org>
Fri, 8 Jun 2012 12:26:52 +0000 (14:26 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 8 Jun 2012 19:29:20 +0000 (21:29 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
source3/smbd/open.c

index d5fba4db192f41eb8d179d025a66bd11c5842fce..7708833f97d9749c29f2d037a3c807add5969f40 100644 (file)
@@ -777,11 +777,9 @@ static NTSTATUS open_file(files_struct *fsp,
        fsp->file_pid = req ? req->smbpid : 0;
        fsp->can_lock = True;
        fsp->can_read = ((access_mask & FILE_READ_DATA) != 0);
-       if (!CAN_WRITE(conn)) {
-               fsp->can_write = False;
-       } else {
-               fsp->can_write = ((access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0);
-       }
+       fsp->can_write =
+               CAN_WRITE(conn) &&
+               ((access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0);
        fsp->print_file = NULL;
        fsp->modified = False;
        fsp->sent_oplock_break = NO_BREAK_SENT;