mirror of
https://github.com/samba-team/samba.git
synced 2025-08-26 01:49:31 +03:00
smbd: Simplify share_mode_entry_do()
Looking at the logic of "ha[d|ve]_share_mode_entry" d->modified=true can only happen if we remove the last share mode entry . Make this more explicit, avoid booleans. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
committed by
Jeremy Allison
parent
c2092cfc44
commit
581ebbcc31
@ -2170,7 +2170,6 @@ static bool share_mode_entry_do(
|
||||
bool modified = false;
|
||||
struct share_mode_entry e;
|
||||
uint8_t *e_ptr = NULL;
|
||||
bool had_share_entries, have_share_entries;
|
||||
NTSTATUS status;
|
||||
bool ret = false;
|
||||
|
||||
@ -2182,8 +2181,6 @@ static bool share_mode_entry_do(
|
||||
}
|
||||
DBG_DEBUG("num_share_modes=%zu\n", ltdb->num_share_entries);
|
||||
|
||||
had_share_entries = (ltdb->num_share_entries != 0);
|
||||
|
||||
idx = share_mode_entry_find(
|
||||
ltdb->share_entries,
|
||||
ltdb->num_share_entries,
|
||||
@ -2229,6 +2226,14 @@ static bool share_mode_entry_do(
|
||||
}
|
||||
ltdb->num_share_entries -= 1;
|
||||
|
||||
if (ltdb->num_share_entries == 0) {
|
||||
/*
|
||||
* Tell share_mode_lock_destructor() to delete
|
||||
* the whole record
|
||||
*/
|
||||
d->modified = true;
|
||||
}
|
||||
|
||||
if (DEBUGLEVEL>=10) {
|
||||
DBG_DEBUG("share_mode_entry:\n");
|
||||
NDR_PRINT_DEBUG(share_mode_entry, &e);
|
||||
@ -2260,15 +2265,6 @@ static bool share_mode_entry_do(
|
||||
goto done;
|
||||
}
|
||||
|
||||
have_share_entries = (ltdb->num_share_entries != 0);
|
||||
if (had_share_entries != have_share_entries) {
|
||||
/*
|
||||
* Make share_mode_data_store do the right thing wrt
|
||||
* possibly deleting the locking.tdb record
|
||||
*/
|
||||
d->modified = true;
|
||||
}
|
||||
|
||||
ret = true;
|
||||
done:
|
||||
TALLOC_FREE(ltdb);
|
||||
|
Reference in New Issue
Block a user