]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify dos_mode_from_sbuf
authorVolker Lendecke <vl@samba.org>
Tue, 25 Jun 2024 14:07:58 +0000 (16:07 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 28 Jun 2024 13:26:24 +0000 (13:26 +0000)
We don't need that else branch, this could be a switch as well

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

index 51d9c0508fe4a8fa5e6faa3a93db584dad04d60a..796cd39626b3b1cf28041fa8b107a82685e430cd 100644 (file)
@@ -215,13 +215,14 @@ static uint32_t dos_mode_from_sbuf(connection_struct *conn,
                if ((st->st_ex_mode & S_IWUSR) == 0) {
                        result |= FILE_ATTRIBUTE_READONLY;
                }
-       } else if (ro_opts == MAP_READONLY_PERMISSIONS) {
+       }
+       if (ro_opts == MAP_READONLY_PERMISSIONS) {
                /* smb_fname->fsp can be NULL for an MS-DFS link. */
                /* Check actual permissions for read-only. */
                if ((fsp != NULL) && !can_write_to_fsp(fsp)) {
                        result |= FILE_ATTRIBUTE_READONLY;
                }
-       } /* Else never set the readonly bit. */
+       }
 
        if (MAP_ARCHIVE(conn) && ((st->st_ex_mode & S_IXUSR) != 0)) {
                result |= FILE_ATTRIBUTE_ARCHIVE;