summaryrefslogtreecommitdiffstats
path: root/source/lib/messages.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-02-02 11:43:13 +0000
committerJeremy Allison <jra@samba.org>2001-02-02 11:43:13 +0000
commit23217434de290262ef1e606691dd1ea56ffd8aae (patch)
treeabd0583c06761c9d6037f78acf2136ab0f3402b5 /source/lib/messages.c
parent94c769a8dabe96347b22f9f7b6a4fb9b66d05972 (diff)
downloadsamba-23217434de290262ef1e606691dd1ea56ffd8aae.tar.gz
samba-23217434de290262ef1e606691dd1ea56ffd8aae.tar.xz
samba-23217434de290262ef1e606691dd1ea56ffd8aae.zip
Merge in fix from John... being in Europe sucks for bandwidth...
Jeremy.
Diffstat (limited to 'source/lib/messages.c')
-rw-r--r--source/lib/messages.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/lib/messages.c b/source/lib/messages.c
index f0e75d430a5..6f6d99c8ecb 100644
--- a/source/lib/messages.c
+++ b/source/lib/messages.c
@@ -223,10 +223,12 @@ BOOL message_send_pid(pid_t pid, int msg_type, void *buf, size_t len, BOOL dupli
ok:
tdb_chainunlock(tdb, kbuf);
+ errno = 0; /* paranoia */
return message_notify(pid);
failed:
tdb_chainunlock(tdb, kbuf);
+ errno = 0; /* paranoia */
return False;
}
@@ -366,7 +368,19 @@ static int traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf, void
memcpy(&crec, dbuf.dptr, sizeof(crec));
if (crec.cnum != -1) return 0;
- message_send_pid(crec.pid, msg_all->msg_type, msg_all->buf, msg_all->len, msg_all->duplicates);
+
+ /* if the msg send fails because the pid was not found (i.e. smbd died),
+ * the msg has already been deleted from the messages.tdb.*/
+ if (!message_send_pid(crec.pid, msg_all->msg_type, msg_all->buf, msg_all->len,
+ msg_all->duplicates)) {
+
+ /* if the pid was not found delete the entry from connections.tdb */
+ if (errno == ESRCH) {
+ DEBUG(2,("pid %d doesn't exist - deleting connections %d [%s]\n",
+ crec.pid, crec.cnum, crec.name));
+ tdb_delete(the_tdb, kbuf);
+ }
+ }
return 0;
}