From da052dde8a9801063e74d036d15f516d079d3720 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 21 Dec 2020 16:49:03 +0100 Subject: [PATCH] s3:smbd: simplify the error handling in create_file_unixpath() We can just call close_file(req, fsp, ERROR_CLOSE), as it handles non-fsa fsp's and base_fsp's just fine. Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke Reviewed-by: Ralph Boehme Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Thu Jan 14 12:40:56 UTC 2021 on sn-devel-184 --- source3/smbd/open.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index cb76d8ae8c0..8846140e4fd 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -5941,11 +5941,6 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, } if (!NT_STATUS_IS_OK(status)) { - /* - * We have to reset the already set base_fsp - * in order to close it in the error cleanup - */ - fsp_set_base_fsp(fsp, NULL); goto fail; } @@ -6056,20 +6051,12 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, DEBUG(10, ("create_file_unixpath: %s\n", nt_errstr(status))); if (fsp != NULL) { - if (base_fsp && fsp->base_fsp == base_fsp) { - /* - * The close_file below will close - * fsp->base_fsp. - */ - base_fsp = NULL; - } - if (!fsp->fsp_flags.is_fsa) { - /* Open wasn't completed. */ - fd_close(fsp); - file_free(req, fsp); - } else { - close_file(req, fsp, ERROR_CLOSE); - } + /* + * The close_file below will close + * fsp->base_fsp. + */ + base_fsp = NULL; + close_file(req, fsp, ERROR_CLOSE); fsp = NULL; } if (base_fsp != NULL) { -- 2.11.4.GIT