From 174ad91d2a34eca1d1d0a86836300ccc024a8e32 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Tue, 30 Nov 2004 20:07:19 +0000 Subject: [PATCH] Changed signal handlers --- mbsebbs/bye.c | 11 +++++++++-- mbsebbs/mbsebbs.c | 11 +---------- mbsebbs/timeout.c | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/mbsebbs/bye.c b/mbsebbs/bye.c index 3f7ce8b9..60377bc9 100644 --- a/mbsebbs/bye.c +++ b/mbsebbs/bye.c @@ -121,9 +121,15 @@ void Good_Bye(int onsig) cookedport(); } Syslog('b', "Will hangup"); - hangup(); + hangup(); Syslog('b', "Done"); + for (i = 0; i < NSIG; i++) { + if ((i == SIGHUP) || (i == SIGPIPE) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM)) + signal(i, SIG_DFL); + } +Syslog('b', "Restored signals"); + if (do_mailout) CreateSema((char *)"mailout"); @@ -169,7 +175,8 @@ void Quick_Bye(int onsig) * Prevent that we call die() if something goes wrong next */ for (i = 0; i < NSIG; i++) - signal(i, SIG_DFL); + if ((i == SIGHUP) || (i == SIGPIPE) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM)) + signal(i, SIG_DFL); colour(LIGHTGRAY, BLACK); sleep(3); diff --git a/mbsebbs/mbsebbs.c b/mbsebbs/mbsebbs.c index 8173430a..28178a01 100644 --- a/mbsebbs/mbsebbs.c +++ b/mbsebbs/mbsebbs.c @@ -78,12 +78,6 @@ int main(int argc, char **argv) Quick_Bye(MBERR_OK); } - /* - * Set the users device to writable by other bbs users, so they - * can send one-line messages - */ -// chmod(tty, 00666); - /* * Get MBSE_ROOT Path and load Config into Memory */ @@ -114,8 +108,7 @@ int main(int argc, char **argv) } PUTSTR((char *)"Loading MBSE BBS ..."); - PUTCHAR('\r'); - PUTCHAR('\n'); + Enter(1); if ((p = getenv("CONNECT")) != NULL) Syslog('+', "CONNECT %s", p); @@ -156,8 +149,6 @@ int main(int argc, char **argv) signal(i, (void (*))die); else if (i == SIGCHLD) signal(i, SIG_DFL); - else if ((i != SIGKILL) && (i != SIGSTOP)) - signal(i, SIG_IGN); } /* diff --git a/mbsebbs/timeout.c b/mbsebbs/timeout.c index 6bef44d8..ccc15560 100644 --- a/mbsebbs/timeout.c +++ b/mbsebbs/timeout.c @@ -48,7 +48,7 @@ extern int hanged_up; /* Hanged up status */ void die(int onsig) { if (onsig <= NSIG) - signal(onsig, SIG_IGN); + signal(onsig, SIG_DFL); /* * First check if there is a child running, if so, kill it.