summaryrefslogtreecommitdiff
path: root/pop3d.c
diff options
context:
space:
mode:
authorroel <roel@7b491191-dbf0-0310-aff6-d879d4d69008>2002-07-08 11:03:12 +0000
committerroel <roel@7b491191-dbf0-0310-aff6-d879d4d69008>2002-07-08 11:03:12 +0000
commitf83fc7e064e17225cfd54c3f9edf6aaf872143b0 (patch)
tree9f1bb1125e15d41006a35deca3e86a0811557fb6 /pop3d.c
parent26613b3278b7249f61b089094816fa83511cccf5 (diff)
*** empty log message ***
git-svn-id: https://svn.ic-s.nl/svn/dbmail/trunk/dbmail@593 7b491191-dbf0-0310-aff6-d879d4d69008
Diffstat (limited to 'pop3d.c')
-rw-r--r--pop3d.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/pop3d.c b/pop3d.c
index 44a9f8ca..2179fda3 100644
--- a/pop3d.c
+++ b/pop3d.c
@@ -72,10 +72,12 @@ static void signal_handler (int signo, siginfo_t *info, void *data)
{
pid_t PID;
int status,i;
+ int saved_errno = errno; /* save error status */
if (signo == SIGUSR1)
{
trace(TRACE_DEBUG, "signal_handler(): caught SIGUSR1, assuming ping");
+ errno = saved_errno;
return;
}
@@ -96,6 +98,8 @@ static void signal_handler (int signo, siginfo_t *info, void *data)
tx = NULL;
rx = NULL;
+
+ errno = saved_errno;
return;
}
else
@@ -114,17 +118,25 @@ static void signal_handler (int signo, siginfo_t *info, void *data)
trace(TRACE_ERROR,"signal_handler(): SIGKILL from [%u]", info->si_uid);
for (i=0; i<defchld; i++)
- if (kill(default_child_pids[i], SIGUSR1) == -1 && errno == ESRCH)
- {
- /* this child no longer exists */
- trace(TRACE_DEBUG, "signal_handler(): cleaning up PID %u", default_child_pids[i]);
- default_child_pids[i] = 0;
- (*default_children)--;
- break;
- }
+ {
+ if (default_child_pids[i] <= 0) /* only allow real PID's (> 0) */
+ continue;
+
+ trace(TRACE_DEBUG,"signal_handler(): sending SIGUSR1 to [%u]\n",default_child_pids[i]);
+
+ if (kill(default_child_pids[i], SIGUSR1) == -1 && errno == ESRCH)
+ {
+ /* this child no longer exists */
+ trace(TRACE_DEBUG, "signal_handler(): cleaning up PID %u", default_child_pids[i]);
+ default_child_pids[i] = 0;
+ (*default_children)--;
+ break;
+ }
+ }
trace (TRACE_DEBUG,"signal_handler(): sigCHLD, cleaned");
}
+ errno = saved_errno;
return;
}
else