]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify reopen_from_fsp() with an early return
authorVolker Lendecke <vl@samba.org>
Thu, 30 Dec 2021 14:59:33 +0000 (15:59 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 1 Feb 2022 19:09:34 +0000 (19:09 +0000)
Review with git show -b

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index 0427b0cef9d37c0636e1dff5edc2541db4343f94..6acc38c80f61b20b5cccbed82491cad297097f11 100644 (file)
@@ -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;
 }