From: Volker Lendecke Date: Thu, 30 Dec 2021 14:59:33 +0000 (+0100) Subject: smbd: Simplify reopen_from_fsp() with an early return X-Git-Tag: tevent-0.12.0~795 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e93f46357fd047c492e2582ee0bab2a0731e7bde;p=thirdparty%2Fsamba.git smbd: Simplify reopen_from_fsp() with an early return Review with git show -b Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 0427b0cef9d..6acc38c80f6 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1227,25 +1227,25 @@ static NTSTATUS reopen_from_fsp(struct files_struct *fsp, status = reopen_from_procfd(fsp, flags, mode); - if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { - /* - * Close the existing pathref fd and set the fsp flag - * is_pathref to false so we get a "normal" fd this - * time. - */ - status = fd_close(fsp); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - fsp->fsp_flags.is_pathref = false; + if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { + return status; + } - status = fd_open_atomic(fsp, - flags, - mode, - p_file_created); + /* + * Close the existing pathref fd and set the fsp flag + * is_pathref to false so we get a "normal" fd this time. + */ + status = fd_close(fsp); + if (!NT_STATUS_IS_OK(status)) { + return status; } + fsp->fsp_flags.is_pathref = false; + + status = fd_open_atomic(fsp, + flags, + mode, + p_file_created); return status; }