]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify share_mode_lock.c
authorVolker Lendecke <vl@samba.org>
Mon, 10 Sep 2018 12:50:40 +0000 (14:50 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 14 Sep 2018 05:49:14 +0000 (07:49 +0200)
"the_lock_id" is not required here. The share mode data carry the file
id, so use that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/locking/share_mode_lock.c

index 6fe75490d3b0192f383383aa9c5570f64e6b32fa..2850e502bdac83ad4c7a14f8b445b1f6c97b2f7e 100644 (file)
@@ -560,12 +560,10 @@ static struct share_mode_lock *get_share_mode_lock_internal(
  * talloc_reference.
  */
 static struct share_mode_lock *the_lock;
-static struct file_id the_lock_id;
 
 static int the_lock_destructor(struct share_mode_lock *l)
 {
        the_lock = NULL;
-       ZERO_STRUCT(the_lock_id);
        return 0;
 }
 
@@ -595,9 +593,8 @@ struct share_mode_lock *get_share_mode_lock(
                        goto fail;
                }
                talloc_set_destructor(the_lock, the_lock_destructor);
-               the_lock_id = id;
        } else {
-               if (!file_id_equal(&the_lock_id, &id)) {
+               if (!file_id_equal(&the_lock->data->id, &id)) {
                        DEBUG(1, ("Can not lock two share modes "
                                  "simultaneously\n"));
                        goto fail;