abort may return (was: Re: Checking Exit Codes)
Geoff Clare
gwc at root.co.uk
Tue Nov 6 01:03:04 AEST 1990
In <18665 at rpp386.cactus.org> jfh at rpp386.cactus.org (John F. Haugh II) writes:
>the normal trick is to set SIGIOT to SIG_DFL, which prevents the signal
>handler from ever catching SIGIOT. this isn't all that far-fetched as
>other library routines catch certain signals, dork around a bit, then
>re-send the same signal they just caught.
>a conforming implementation might be
>void
>abort (void)
>{
> signal (SIGABRT, SIG_DFL);
> kill (getpid (), SIGABRT);
> exit (1);
>}
If SIGABRT is being caught, the above will prevent the signal handler
from being called. It should be:
void
abort (void)
{
(void) raise(SIGABRT);
(void) signal(SIGABRT, SIG_DFL);
(void) raise(SIGABRT);
exit (1);
}
A POSIX version should unblock SIGABRT as well.
--
Geoff Clare <gwc at root.co.uk> (Dumb American mailers: ...!uunet!root.co.uk!gwc)
UniSoft Limited, Hayne Street, London EC1A 9HH, England. Tel: +44-71-315-6600
More information about the Comp.unix.internals
mailing list