From 45005d4b71cfed06fad2f12ee17f2b8c82eb16ac Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 5 Sep 2023 14:46:21 +0200 Subject: [PATCH] smbd: Simplify open_file() We can unconditionally just and-out O_CREAT from local_flags, so remove an if-condition. Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- source3/smbd/open.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index efcd0ceec8e..3b7236b8895 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1355,13 +1355,12 @@ static NTSTATUS open_file(struct smb_request *req, smb_fname_str_dbg(smb_fname))); return NT_STATUS_ACCESS_DENIED; } - if (flags & O_CREAT) { - /* We don't want to write - but we must make sure that - O_CREAT doesn't create the file if we have write - access into the directory. - */ - local_flags &= ~(O_CREAT|O_EXCL); - } + /* + * We don't want to write - but we must make sure that + * O_CREAT doesn't create the file if we have write + * access into the directory. + */ + local_flags &= ~(O_CREAT | O_EXCL); } /* -- 2.47.3