commit 8d914c10ccefb3ca05c9ae15d1568d02be321ca0
parent 8dab3ad263a58c0c0391732de9926f21779f462f
Author: sin <sin@2f30.org>
Date: Tue, 15 Jul 2014 18:01:48 +0100
Use sigaction()
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/crond.c b/crond.c
@@ -429,6 +429,7 @@ main(int argc, char *argv[])
struct ctabentry *cte;
time_t t;
struct tm *tm;
+ struct sigaction sa;
ARGBEGIN {
case 'n':
@@ -453,9 +454,11 @@ main(int argc, char *argv[])
}
}
- signal(SIGCHLD, sighandler);
- signal(SIGHUP, sighandler);
- signal(SIGTERM, sighandler);
+ sa.sa_handler = sighandler;
+ sa.sa_flags = SA_RESTART;
+ sigaction(SIGCHLD, &sa, NULL);
+ sigaction(SIGHUP, &sa, NULL);
+ sigaction(SIGTERM, &sa, NULL);
loadentries();