Fixed NetBSD hangup and character reading

This commit is contained in:
Michiel Broek 2004-12-06 21:33:30 +00:00
parent fb76e3b6bb
commit 14db48511e
3 changed files with 21 additions and 10 deletions

View File

@ -121,8 +121,8 @@ void Good_Bye(int onsig)
cookedport(); cookedport();
} }
Syslog('b', "Will hangup"); Syslog('b', "Will hangup");
signal(SIGHUP, SIG_IGN);
hangup(); hangup();
Syslog('b', "Done");
for (i = 0; i < NSIG; i++) { for (i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGPIPE) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM)) if ((i == SIGHUP) || (i == SIGPIPE) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
@ -170,19 +170,25 @@ void Quick_Bye(int onsig)
sprintf(temp, "%s/tmp/mbsebbs%d", getenv("MBSE_ROOT"), getpid()); sprintf(temp, "%s/tmp/mbsebbs%d", getenv("MBSE_ROOT"), getpid());
unlink(temp); unlink(temp);
free(temp); free(temp);
colour(LIGHTGRAY, BLACK);
sleep(3);
if ((onsig != SIGALRM) && (onsig != MBERR_TIMEOUT) && (hanged_up == 0)) {
cookedport();
}
/*
* Ignore SIGHUP during hangup
*/
signal(SIGHUP, SIG_IGN);
hangup();
/* /*
* Prevent that we call die() if something goes wrong next * Prevent that we call die() if something goes wrong next
*/ */
for (i = 0; i < NSIG; i++) for (i = 0; i < NSIG; i++)
if ((i == SIGHUP) || (i == SIGPIPE) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM)) if ((i == SIGHUP) || (i == SIGPIPE) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, SIG_DFL); signal(i, SIG_DFL);
colour(LIGHTGRAY, BLACK);
sleep(3);
cookedport();
hangup();
free(pTTY); free(pTTY);
if (StartTime) if (StartTime)

View File

@ -53,7 +53,11 @@ int Waitchar(unsigned char *ch, int wtime)
// Syslog('t', "Waitchar(): after GETCHAR() tty_status = %d, rc = %d", tty_status, rc); // Syslog('t', "Waitchar(): after GETCHAR() tty_status = %d, rc = %d", tty_status, rc);
if (tty_status == STAT_SUCCESS) { if (tty_status == STAT_SUCCESS) {
// Syslog('t', "Waitchar(): return %d", rc); // Syslog('t', "Waitchar(): return %d", rc);
#ifdef __NetBSD__
*ch = (unsigned char)rc;
#else
memcpy(ch, &rc, sizeof(unsigned char)); memcpy(ch, &rc, sizeof(unsigned char));
#endif
return 1; return 1;
} }
if (tty_status != STAT_TIMEOUT) { if (tty_status != STAT_TIMEOUT) {
@ -62,7 +66,7 @@ int Waitchar(unsigned char *ch, int wtime)
} }
msleep(10); msleep(10);
} }
// Syslog('t', "Waitchar() timeout returns %d", rc); // Syslog('t', "Waitchar() timeout returns %d", rc);
return rc; return rc;
} }

View File

@ -625,6 +625,7 @@ void Fast_Bye(int onsig)
sleep(3); sleep(3);
cookedport(); cookedport();
signal(SIGHUP, SIG_IGN);
hangup(); hangup();
Free_Language(); Free_Language();