From 6820e56684dd3a36e0bae82ea906e108d875fb68 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Mon, 5 Jan 2004 16:10:30 +0000 Subject: [PATCH] Replace use of signal() by sigaction(). signal() is not very consistent. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@91 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- nethackstub.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nethackstub.c b/nethackstub.c index e1fea05..12d040f 100644 --- a/nethackstub.c +++ b/nethackstub.c @@ -20,7 +20,7 @@ * This program can be used instead of nethack to test dgamelaunch. */ -static const char rcsid[] = "$Id: nethackstub.c,v 1.1 2004/01/05 14:01:03 jilles Exp $"; +static const char rcsid[] = "$Id: nethackstub.c,v 1.2 2004/01/05 16:10:30 jilles Exp $"; #include @@ -51,6 +51,7 @@ main(int argc, char *argv[]) { char buf[256]; int showusage = 1, n, i; + struct sigaction SA; #define S "nethackstub started with arguments:\n" write(STDOUT_FILENO, S, -1 + sizeof S); @@ -63,8 +64,12 @@ main(int argc, char *argv[]) #undef S } - signal(SIGHUP, sighup); - signal(SIGTERM, sigterm); + sigemptyset(&SA.sa_mask); + SA.sa_flags = 0; + SA.sa_handler = sighup; + sigaction(SIGHUP, &SA, NULL); + SA.sa_handler = sigterm; + sigaction(SIGTERM, &SA, NULL); for (;;) {