Skip to content

Commit

Permalink
smbd: Simplify reopen_from_fsp() with an early return
Browse files Browse the repository at this point in the history
Review with git show -b

Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
  • Loading branch information
vlendec authored and jrasamba committed Feb 1, 2022
1 parent 1d6762d commit e93f463
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions source3/smbd/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit e93f463

Please sign in to comment.