From: Volker Lendecke Date: Fri, 1 Sep 2023 14:31:03 +0000 (+0200) Subject: smbd: Slightly simplify open_file() X-Git-Tag: tevent-0.16.0~232 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=236df26a1f4451f5e7fd66fe52ce7fda77bc9abf;p=thirdparty%2Fsamba.git smbd: Slightly simplify open_file() Replace "truncating" variable reference with what it was defined as. We use "(flags & O_TRUNC)" a few lines above, so it can't be that bad. After we set it to "false" further down, it was never used again. Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index a6c16da8aa3..72ce0bf8e49 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1325,7 +1325,6 @@ static NTSTATUS open_file(struct smb_request *req, FILE_EXECUTE | SEC_FLAG_SYSTEM_SECURITY; bool creating = !file_existed && (flags & O_CREAT); - bool truncating = (flags & O_TRUNC); bool open_fd = false; bool posix_open = (fsp->posix_flags & FSP_POSIX_FLAGS_OPEN); @@ -1384,7 +1383,8 @@ static NTSTATUS open_file(struct smb_request *req, local_flags = (flags & ~O_ACCMODE)|O_RDWR; } - if ((open_access_mask & need_fd_mask) || creating || truncating) { + if ((open_access_mask & need_fd_mask) || creating || + (flags & O_TRUNC)) { open_fd = true; } @@ -1402,7 +1402,6 @@ static NTSTATUS open_file(struct smb_request *req, if (file_existed && S_ISFIFO(smb_fname->st.st_ex_mode)) { local_flags &= ~O_TRUNC; /* Can't truncate a FIFO. */ local_flags |= O_NONBLOCK; - truncating = false; } #endif