]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: simplify the error handling in create_file_unixpath()
authorStefan Metzmacher <metze@samba.org>
Mon, 21 Dec 2020 15:49:03 +0000 (16:49 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 14 Jan 2021 12:40:56 +0000 (12:40 +0000)
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 <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jan 14 12:40:56 UTC 2021 on sn-devel-184

source3/smbd/open.c

index cb76d8ae8c0ffbde0f129048c8c3c65c7e74f91c..8846140e4fd547ba3c599c91ee84b8d374e3d36e 100644 (file)
@@ -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) {