aboutsummaryrefslogtreecommitdiff
path: root/src/com_start.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/com_start.c')
-rw-r--r--src/com_start.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com_start.c b/src/com_start.c
index 5744e39..3a9dffc 100644
--- a/src/com_start.c
+++ b/src/com_start.c
@@ -40,15 +40,19 @@ sigchld(int sig)
int
timedwaitpid(pid_t pid, int *status)
{
struct timeval now, stoptime, ttw;
int rc = -1;
- SIGHANDLER oldsig;
+ struct sigaction act, oldact;
+
+ act.sa_handler = sigchld;
+ act.sa_flags = 0;
+ sigemptyset(&act.sa_mask);
+ sigaction(SIGCHLD, &act, &oldact);
- oldsig = signal(SIGCHLD, sigchld);
gettimeofday(&stoptime, NULL);
stoptime.tv_sec += genrc_timeout;
while (1) {
pid_t p;
p = waitpid(pid, status, WNOHANG);
@@ -70,13 +74,13 @@ timedwaitpid(pid_t pid, int *status)
system_error(errno, "select");
break;
}
}
}
- signal(SIGCHLD, oldsig);
+ sigaction(SIGCHLD, &oldact, NULL);
if (rc) {
kill(pid, SIGKILL);
}
return rc;
}

Return to:

Send suggestions and report system problems to the System administrator.