diff options
author | Volker Lendecke <vlendec@samba.org> | 2007-03-05 20:09:27 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:18:24 -0500 |
commit | 242927bd5cae1d2ab8739b1c424e702ab97726b5 (patch) | |
tree | f4b220aa9df89f0a143a490bc82f00091b9a4b38 | |
parent | 0ebac7d7cc8ce9924cb585629e3f2508237e1636 (diff) | |
download | samba-242927bd5cae1d2ab8739b1c424e702ab97726b5.tar.gz samba-242927bd5cae1d2ab8739b1c424e702ab97726b5.tar.bz2 samba-242927bd5cae1d2ab8739b1c424e702ab97726b5.zip |
r21706: get_delete_on_close_flag() is the perfect candidate for tdb_parse_record()
(This used to be commit b73685d20751ac343faab79332552cd7ee92d831)
-rw-r--r-- | source3/locking/locking.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c index ffac43aff5..7326ea08c0 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -858,15 +858,29 @@ BOOL rename_share_filename(struct share_mode_lock *lck, return True; } -BOOL get_delete_on_close_flag(SMB_DEV_T dev, SMB_INO_T inode) +static int pull_delete_on_close_flag(TDB_DATA key, TDB_DATA dbuf, + void *private_data) { - BOOL result; - struct share_mode_lock *lck = get_share_mode_lock(NULL, dev, inode, NULL, NULL); - if (!lck) { - return False; + BOOL *result = (BOOL *)private_data; + struct locking_data *data; + + if (dbuf.dsize < sizeof(struct locking_data)) { + smb_panic("PANIC: parse_share_modes: buffer too short.\n"); } - result = lck->delete_on_close; - TALLOC_FREE(lck); + + data = (struct locking_data *)dbuf.dptr; + + *result = data->u.s.delete_on_close; + return 0; +} + +BOOL get_delete_on_close_flag(SMB_DEV_T dev, SMB_INO_T inode) +{ + TDB_DATA key = locking_key(dev, inode); + BOOL result = False; + + tdb_parse_record(tdb, key, pull_delete_on_close_flag, + (void *)&result); return result; } |