diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-09-11 07:34:04 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-09-11 07:34:04 +0000 |
commit | 3142387c19602c242ca0bb03e0a1118048e76f74 (patch) | |
tree | bee7c4528a2ad1a54f6895919126f6a4258ddd89 /omusrmsg.c | |
parent | d808cceebff701e5d6bb81be8414509d1381ddf9 (diff) | |
download | rsyslog-3142387c19602c242ca0bb03e0a1118048e76f74.tar.gz rsyslog-3142387c19602c242ca0bb03e0a1118048e76f74.tar.xz rsyslog-3142387c19602c242ca0bb03e0a1118048e76f74.zip |
applied patch by varmojfekoj to change signal handling to the new sigaction
API set (replacing the depreciated signal() calls and its friends.
Diffstat (limited to 'omusrmsg.c')
-rw-r--r-- | omusrmsg.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -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); |