summaryrefslogtreecommitdiffstats
path: root/omusrmsg.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-09-11 07:34:04 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-09-11 07:34:04 +0000
commit3142387c19602c242ca0bb03e0a1118048e76f74 (patch)
treebee7c4528a2ad1a54f6895919126f6a4258ddd89 /omusrmsg.c
parentd808cceebff701e5d6bb81be8414509d1381ddf9 (diff)
downloadrsyslog-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.c15
1 files changed, 11 insertions, 4 deletions
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);