From 01d45db46b5e9ad4e6b9c9552c74c655eeafa78b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 3 Feb 2001 17:19:10 +0000 Subject: Merge from 2.2 - with connection fix. Jeremy. (This used to be commit 8d3601c1366b5f0a9f5772e9797ff54a2250dbfd) --- source3/lib/messages.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'source3/lib/messages.c') 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; } -- cgit