summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-11-17 00:48:02 +0000
committerJeremy Allison <jra@samba.org>2000-11-17 00:48:02 +0000
commit29e6b9cdd089eccc6ed0877d8bad8eb193e339e1 (patch)
tree266df73bbb8eba905e2ba1cf8d7fa8bd98b07675 /source3/lib
parent901c3224deb650826f418313e2c7e76602403788 (diff)
downloadsamba-29e6b9cdd089eccc6ed0877d8bad8eb193e339e1.tar.gz
samba-29e6b9cdd089eccc6ed0877d8bad8eb193e339e1.tar.bz2
samba-29e6b9cdd089eccc6ed0877d8bad8eb193e339e1.zip
Delete queue on empty.
Jeremy. (This used to be commit 6e18a2aa58bc485e3c803ff357acc1b7fe6d95e1)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/messages.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 8b50533610..8f181f0982 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -278,9 +278,14 @@ static BOOL message_recv(int *msg_type, pid_t *src, void **buf, size_t *len)
*msg_type = rec.msg_type;
*src = rec.src;
- memmove(dbuf.dptr, dbuf.dptr+sizeof(rec)+rec.len, dbuf.dsize - (sizeof(rec)+rec.len));
+ if (dbuf.dsize - (sizeof(rec)+rec.len) > 0)
+ memmove(dbuf.dptr, dbuf.dptr+sizeof(rec)+rec.len, dbuf.dsize - (sizeof(rec)+rec.len));
dbuf.dsize -= sizeof(rec)+rec.len;
- tdb_store(tdb, kbuf, dbuf, TDB_REPLACE);
+
+ if (dbuf.dsize == 0)
+ tdb_delete(tdb, kbuf);
+ else
+ tdb_store(tdb, kbuf, dbuf, TDB_REPLACE);
free(dbuf.dptr);
tdb_unlockchain(tdb, kbuf);