On 08/30/2010 05:20 PM, Bruno Haible wrote:
static void quit (int sig) { exit (sig + 128); }
...
signal (SIGALRM, quit);
I tested this on FreeBSD, and it indeed works. And given that sleep.m4
already installs a handler, it's no less portable than what we are
already doing in other tests.
If you write it like this, it will be a no-op (because the shell does
not see the signal that killed the process, it sees the exit code of the
process). You need to write
static void quit (int sig) { exit (1); }
Huh? It won't be a signal, but it WILL be a valid exit code, and it may
make post-mortem analysis easier (that is, most shells set $? to
signal+128 when they detect exit via a signal; we've lost the detection
of exit from a signal, but having a $? that matches in the config.log
output may still be handy). Exit codes do not need to be between 1 and
127 in order to be non-zero.
Affected files: strstr.m4, strcasestr.m4, memmem.m4.
Yep, I came to the same conclusion. Pushing my patch soon.
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org