From 3142387c19602c242ca0bb03e0a1118048e76f74 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 11 Sep 2007 07:34:04 +0000 Subject: applied patch by varmojfekoj to change signal handling to the new sigaction API set (replacing the depreciated signal() calls and its friends. --- omusrmsg.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'omusrmsg.c') diff --git a/omusrmsg.c b/omusrmsg.c index 0697b59c..3af0c325 100644 --- a/omusrmsg.c +++ b/omusrmsg.c @@ -158,6 +158,7 @@ static rsRetVal wallmsg(uchar* pMsg, instanceData *pData) static int reenter = 0; struct utmp ut; struct utmp *uptr; + struct sigaction sigAct; assert(pMsg != NULL); @@ -172,12 +173,17 @@ static rsRetVal wallmsg(uchar* pMsg, instanceData *pData) * and doing notty(). */ if (fork() == 0) { - signal(SIGTERM, SIG_DFL); + memset(&sigAct, 0, sizeof(sigAct)); + sigemptyset(&sigAct.sa_mask); + sigAct.sa_handler = SIG_DFL; + sigaction(SIGTERM, &sigAct, NULL); alarm(0); + # ifdef SIGTTOU - signal(SIGTTOU, SIG_IGN); + sigAct.sa_handler = SIG_DFL; + sigaction(SIGTERM, &sigAct, NULL); # endif - sigsetmask(0); + sigprocmask(SIG_SETMASK, &sigAct.sa_mask, NULL); /* TODO: find a way to limit the max size of the message. hint: this * should go into the template! */ @@ -219,7 +225,8 @@ static rsRetVal wallmsg(uchar* pMsg, instanceData *pData) strncat(p, ut.ut_line, UNAMESZ); if (setjmp(ttybuf) == 0) { - (void) signal(SIGALRM, endtty); + sigAct.sa_handler = endtty; + sigaction(SIGALRM, &sigAct, NULL); (void) alarm(15); /* open the terminal */ ttyf = open(p, O_WRONLY|O_NOCTTY); -- cgit