...
| Code Block |
|---|
void (*signal(int sig, void (*func)(int)))(int); |
There are two kinds of ways to send a signal: synchronous (as initiated by a call to raise() or abort()) and asynchronous (initiated from outside the current process). Most of the rules and recommendations in this section do not apply to signals that are invoked synchronously, as there is no significant difference between signal handlers that are invoked by a call to a library function and signal handlers that are invoked by a call to the handler itself. However, there is no way to prevent external processes from sending asynchronous signals to a program that handles synchronous signals. Thus, any program that handles signals must be prepared to handle asynchronous signals from potentially hostile sources.
Improper handling of signals can lead to security vulnerabilities. The following rules and recommendations are meant to eliminate common errors associated with signal handling.
...