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();
}
Syslog('b', "Will hangup");
signal(SIGHUP, SIG_IGN);
hangup();
Syslog('b', "Done");
for (i = 0; i < NSIG; i++) {
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());
unlink(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
*/
for (i = 0; i < NSIG; i++)
if ((i == SIGHUP) || (i == SIGPIPE) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, SIG_DFL);
colour(LIGHTGRAY, BLACK);
sleep(3);
cookedport();
hangup();
if ((i == SIGHUP) || (i == SIGPIPE) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, SIG_DFL);
free(pTTY);
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);
if (tty_status == STAT_SUCCESS) {
// Syslog('t', "Waitchar(): return %d", rc);
#ifdef __NetBSD__
*ch = (unsigned char)rc;
#else
memcpy(ch, &rc, sizeof(unsigned char));
#endif
return 1;
}
if (tty_status != STAT_TIMEOUT) {
@ -62,7 +66,7 @@ int Waitchar(unsigned char *ch, int wtime)
}
msleep(10);
}
// Syslog('t', "Waitchar() timeout returns %d", rc);
// Syslog('t', "Waitchar() timeout returns %d", rc);
return rc;
}

View File

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