diff options
author | roel <roel@7b491191-dbf0-0310-aff6-d879d4d69008> | 2002-07-08 11:03:12 +0000 |
---|---|---|
committer | roel <roel@7b491191-dbf0-0310-aff6-d879d4d69008> | 2002-07-08 11:03:12 +0000 |
commit | f83fc7e064e17225cfd54c3f9edf6aaf872143b0 (patch) | |
tree | 9f1bb1125e15d41006a35deca3e86a0811557fb6 /pop3d.c | |
parent | 26613b3278b7249f61b089094816fa83511cccf5 (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.c | 28 |
1 files changed, 20 insertions, 8 deletions
@@ -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 |