Content deleted Content added
Mitch Ames (talk | contribs) →Standard signals: rm unnecessary bold - see MOS:NOBOLD |
Change catch_function() to be reentrant. Signal handlers are required to be reetrant functions and cannot call non-reetrant functions such as puts(). |
||
Line 54:
#include <stdio.h>
#include <stdlib.h>
volatile sig_atomic_t status = 0;
static void catch_function(int signo) {
status = signo;
puts("Interactive attention signal caught.");▼
}
Line 66 ⟶ 68:
}
puts("Raising the interactive attention signal.");
if (raise(SIGINT)
fputs("Error raising the signal.\n", stderr);
return EXIT_FAILURE;
}
▲ if (status == SIGINT) puts("Interactive attention signal caught.");
puts("Exiting.");
return EXIT_SUCCESS;
|