summaryrefslogtreecommitdiff
path: root/source3/lib/messages.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-02-03 17:19:10 +0000
committerJeremy Allison <jra@samba.org>2001-02-03 17:19:10 +0000
commit01d45db46b5e9ad4e6b9c9552c74c655eeafa78b (patch)
tree01748543a4b1ba14111fd48bd161041c684b04f7 /source3/lib/messages.c
parentf9a2be782207013445e2f228a08e44b209a9133c (diff)
downloadsamba-01d45db46b5e9ad4e6b9c9552c74c655eeafa78b.tar.gz
samba-01d45db46b5e9ad4e6b9c9552c74c655eeafa78b.tar.bz2
samba-01d45db46b5e9ad4e6b9c9552c74c655eeafa78b.zip
Merge from 2.2 - with connection fix.
Jeremy. (This used to be commit 8d3601c1366b5f0a9f5772e9797ff54a2250dbfd)
Diffstat (limited to 'source3/lib/messages.c')
-rw-r--r--source3/lib/messages.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index f0e75d430a..6f6d99c8ec 100644
--- a/source3/lib/messages.c
+++ b/source3/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;
}