Bruno Haible <[EMAIL PROTECTED]> writes: > if (sigaction (fatal_signals[i], NULL, &action) >= 0 > + /* POSIX says that SIG_IGN can only occur when action.sa_flags > + does not contain SA_SIGINFO. But in Linux 2.4, for example, > + SA_SIGINFO can actually be set and is ignored when sa_handler > + is SIG_IGN. So don't bother testing for SA_SIGINFO. */ > && action.sa_handler == SIG_IGN) > fatal_signals[i] = -1;
I'd feel a bit safer if we wrote the code to conform to POSIX rather than assume the typical implementation where sa_handler and sa_sigaction overlap. How about something like this instead? if (sigaction (fatal_signals[i], NULL, &action) == 0 && ((action.sa_flags & SA_SIGINFO ? (void (*) (int)) action.sa_sigaction : action.sa_handler) == SIG_IGN)) fatal_signals[i] = -1; This avoids undefined behavior from the point of view of C, while remaining portable to implementations where sa_handler and sa_sigaction don't overlap. On typical implementations with a good optimizing compiler, this code should run just as fast as what's in there now.