diff options
author | Jeremy Allison <jra@samba.org> | 2000-10-02 19:28:26 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-10-02 19:28:26 +0000 |
commit | c1de97f96b8c5ad8e5f01a0d17c6387733769442 (patch) | |
tree | 34357c4cc955f60957d5409a7e0304f5fd64f498 /source/tdb | |
parent | 3733d29ce678c71ef2ee8b600e547765d8d8ea9e (diff) | |
download | samba-c1de97f96b8c5ad8e5f01a0d17c6387733769442.tar.gz samba-c1de97f96b8c5ad8e5f01a0d17c6387733769442.tar.xz samba-c1de97f96b8c5ad8e5f01a0d17c6387733769442.zip |
Added debug so if zero length messages get sent we successfully remove
them (this can happen if smbd processes are shut down at the wrong time).
Jeremy.
Diffstat (limited to 'source/tdb')
-rw-r--r-- | source/tdb/tdb.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/tdb/tdb.c b/source/tdb/tdb.c index c653c79d681..d9401d95d4c 100644 --- a/source/tdb/tdb.c +++ b/source/tdb/tdb.c @@ -696,9 +696,12 @@ TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key) rec_ptr = tdb_find(tdb, key, hash, &rec); if (rec_ptr) { - ret.dptr = tdb_alloc_read(tdb, - rec_ptr + sizeof(rec) + rec.key_len, + if (rec.data_len) + ret.dptr = tdb_alloc_read(tdb, + rec_ptr + sizeof(rec) + rec.key_len, rec.data_len); + else + ret.dptr = NULL; ret.dsize = rec.data_len; } @@ -1106,7 +1109,8 @@ int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag) memcpy(p, &rec, sizeof(rec)); memcpy(p+sizeof(rec), key.dptr, key.dsize); - memcpy(p+sizeof(rec)+key.dsize, dbuf.dptr, dbuf.dsize); + if (dbuf.dsize) + memcpy(p+sizeof(rec)+key.dsize, dbuf.dptr, dbuf.dsize); if (tdb_write(tdb, rec_ptr, p, sizeof(rec)+key.dsize+dbuf.dsize) == -1) goto fail; |