smbd: simplify error codepath in openat_pathref_fsp()
[samba.git] / source3 / smbd / files.c
index 8d7ecabe2851e5b2d8c70b378129fbb15c5d52a2..e3e02e5dad1cf965978c9237b0114ab3b1c5e674 100644 (file)
@@ -502,21 +502,6 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp,
 
        status = fd_openat(dirfsp, smb_fname, fsp, open_flags, 0);
        if (!NT_STATUS_IS_OK(status)) {
-               DBG_DEBUG("Could not open fd for [%s]: %s\n",
-                         fsp_str_dbg(fsp),
-                         nt_errstr(status));
-
-               if (fsp->base_fsp != NULL) {
-                       struct files_struct *tmp_base_fsp = fsp->base_fsp;
-
-                       fsp_set_base_fsp(fsp, NULL);
-
-                       fd_close(tmp_base_fsp);
-                       file_free(NULL, tmp_base_fsp);
-               }
-               file_free(NULL, fsp);
-               fsp = NULL;
-
                if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND) ||
                    NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_PATH_NOT_FOUND))
                {
@@ -533,11 +518,7 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp,
                         */
                        status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
                }
-               if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
-                       goto fail;
-               }
-
-               return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+               goto fail;
        }
 
        if (!check_same_dev_ino(&smb_fname->st, &fsp->fsp_name->st)) {