summaryrefslogtreecommitdiffstats
path: root/omusrmsg.c
diff options
context:
space:
mode:
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);