From a069d4d72fea8c283dd67a08ba30b49beefcd7de Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 23 Apr 2000 14:25:04 +0000 Subject: fixed a locking database bug - it was actually harmless except that smbstatus could display the wrong filename when files change dev/inum after a rename (This used to be commit 990b16fcf7af74f376db157a3e5de7bb68c1a4a1) --- source3/locking/locking.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source3/locking/locking.c b/source3/locking/locking.c index affda89f08..9f33cba338 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -708,7 +708,11 @@ void del_share_mode(files_struct *fsp) dbuf.dsize -= del_count * sizeof(*shares); /* store it back in the database */ - tdb_store(tdb, locking_key_fsp(fsp), dbuf, TDB_REPLACE); + if (data->num_share_mode_entries == 0) { + tdb_delete(tdb, locking_key_fsp(fsp)); + } else { + tdb_store(tdb, locking_key_fsp(fsp), dbuf, TDB_REPLACE); + } free(dbuf.dptr); } @@ -815,7 +819,11 @@ static BOOL mod_share_mode(files_struct *fsp, /* if the mod fn was called then store it back */ if (need_store) { - tdb_store(tdb, locking_key_fsp(fsp), dbuf, TDB_REPLACE); + if (data->num_share_mode_entries == 0) { + tdb_delete(tdb, locking_key_fsp(fsp)); + } else { + tdb_store(tdb, locking_key_fsp(fsp), dbuf, TDB_REPLACE); + } } free(dbuf.dptr); -- cgit