Don't call exit(3) from a signal handler.

Obtained from:	OpenBSD
This commit is contained in:
Dima Dorfman 2001-06-24 01:55:17 +00:00
parent 9e28aca5d2
commit e0e97f0aab
2 changed files with 3 additions and 4 deletions

View File

@ -104,6 +104,5 @@ terminate(sig)
int sig; int sig;
{ {
/* XXX exit() shouldn't call exit() from a signal handler. */ _exit(sig == 0 ? 0 : 1);
exit(sig == 0 ? 0 : 1);
} }

View File

@ -1400,7 +1400,7 @@ handle_hup(signo)
strcat(hup, "ed.hup"); strcat(hup, "ed.hup");
write_file(hup, "w", 1, addr_last); write_file(hup, "w", 1, addr_last);
} }
quit(2); _exit(2);
} }
@ -1409,7 +1409,7 @@ handle_int(signo)
int signo; int signo;
{ {
if (!sigactive) if (!sigactive)
quit(1); _exit(1);
sigflags &= ~(1 << (signo - 1)); sigflags &= ~(1 << (signo - 1));
#ifdef _POSIX_SOURCE #ifdef _POSIX_SOURCE
siglongjmp(env, -1); siglongjmp(env, -1);