From: Ralph Boehme Date: Wed, 4 Mar 2020 09:56:56 +0000 (+0100) Subject: smbd: refactor flags computation for fd_open() in open_directory() a bit X-Git-Tag: ldb-2.2.0~449 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f1d204c5bac1ac490369e1acd1811330da02ab76;p=thirdparty%2Fsamba.git smbd: refactor flags computation for fd_open() in open_directory() a bit 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 9abfe1b6d97..d95164a93dc 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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",