]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: refactor flags computation for fd_open() in open_directory() a bit
authorRalph Boehme <slow@samba.org>
Wed, 4 Mar 2020 09:56:56 +0000 (10:56 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 21 May 2020 05:23:29 +0000 (05:23 +0000)
No change in behaviour. A subsequent commit will optionally add an additional
flag, this change allows for a smaller diff of that commit.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index 9abfe1b6d97018fe229a01ba6825a59f9c10f69f..d95164a93dc232b9fb0d3bde835fc5275c830258 100644 (file)
@@ -4276,6 +4276,7 @@ static NTSTATUS open_directory(connection_struct *conn,
        NTSTATUS status;
        struct timespec mtimespec;
        int info = 0;
+       int flags;
        bool ok;
 
        if (is_ntfs_stream_smb_fname(smb_dname)) {
@@ -4487,12 +4488,13 @@ static NTSTATUS open_directory(connection_struct *conn,
        */
        mtimespec = make_omit_timespec();
 
-#ifdef O_DIRECTORY
-       status = fd_open(conn, fsp, O_RDONLY|O_DIRECTORY, 0);
-#else
        /* POSIX allows us to open a directory with O_RDONLY. */
-       status = fd_open(conn, fsp, O_RDONLY, 0);
+       flags = O_RDONLY;
+#ifdef O_DIRECTORY
+       flags |= O_DIRECTORY;
 #endif
+
+       status = fd_open(conn, fsp, flags, 0);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_INFO("Could not open fd for "
                        "%s (%s)\n",