]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:locking: simplify code in get_share_mode_lock()
authorRalph Boehme <slow@samba.org>
Thu, 28 Nov 2019 10:18:29 +0000 (10:18 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 5 Dec 2019 20:12:23 +0000 (20:12 +0000)
The call to get_static_share_mode_data() is identical in the if/else branches,
so move it behind them.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Dec  5 20:12:23 UTC 2019 on sn-devel-184

source3/locking/share_mode_lock.c

index c42cafe17e4608696090bbcc55527c20120c6a09..edf47274d29389c024139d6f3d9bfbc539022e71 100644 (file)
@@ -615,18 +615,6 @@ struct share_mode_lock *get_share_mode_lock(
                static_share_mode_record_value = dbwrap_record_get_value(
                        static_share_mode_record);
 
-               status = get_static_share_mode_data(
-                       static_share_mode_record,
-                       id,
-                       servicepath,
-                       smb_fname,
-                       old_write_time);
-               if (!NT_STATUS_IS_OK(status)) {
-                       DBG_DEBUG("get_static_share_mode_data failed: %s\n",
-                                 nt_errstr(status));
-                       TALLOC_FREE(static_share_mode_record);
-                       goto fail;
-               }
        } else {
                TDB_DATA static_key;
                int cmp;
@@ -639,18 +627,18 @@ struct share_mode_lock *get_share_mode_lock(
                                    "simultaneously\n");
                        return NULL;
                }
+       }
 
-               status = get_static_share_mode_data(
-                       static_share_mode_record,
-                       id,
-                       servicepath,
-                       smb_fname,
-                       old_write_time);
-               if (!NT_STATUS_IS_OK(status)) {
-                       DBG_WARNING("get_static_share_mode_data failed: %s\n",
-                                   nt_errstr(status));
-                       goto fail;
-               }
+       status = get_static_share_mode_data(static_share_mode_record,
+                                           id,
+                                           servicepath,
+                                           smb_fname,
+                                           old_write_time);
+       if (!NT_STATUS_IS_OK(status)) {
+               DBG_DEBUG("get_static_share_mode_data failed: %s\n",
+                         nt_errstr(status));
+               TALLOC_FREE(static_share_mode_record);
+               goto fail;
        }
 
 done: