From 1fa730deba0f36947775fe490b9be98a92560b3f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 4 Sep 2012 09:28:26 +0200 Subject: [PATCH] s3: Slightly simplify calculate_open_access_flags --- source3/smbd/open.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 8c24ef9ff10..1f9a372dfb6 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1873,8 +1873,7 @@ static int calculate_open_access_flags(uint32_t access_mask, int oplock_request, uint32_t private_flags) { - int flags; - bool need_write; + bool need_write, need_read; /* * Note that we ignore the append flag as append does not @@ -1892,14 +1891,16 @@ static int calculate_open_access_flags(uint32_t access_mask, /* DENY_DOS opens are always underlying read-write on the file handle, no matter what the requested access mask says. */ - if ((private_flags & NTCREATEX_OPTIONS_PRIVATE_DENY_DOS) || - access_mask & (FILE_READ_ATTRIBUTES|FILE_READ_DATA| - FILE_READ_EA|FILE_EXECUTE)) { - flags = O_RDWR; - } else { - flags = O_WRONLY; + + need_read = + ((private_flags & NTCREATEX_OPTIONS_PRIVATE_DENY_DOS) || + access_mask & (FILE_READ_ATTRIBUTES|FILE_READ_DATA| + FILE_READ_EA|FILE_EXECUTE)); + + if (!need_read) { + return O_WRONLY; } - return flags; + return O_RDWR; } /**************************************************************************** -- 2.11.4.GIT