Update manpage to match source code for --map-file
[tftp-hpa.git] / lib / bsdsignal.c
blob0aae13611842b9b095e68ac14623284dfe7618c1
1 /*
2 * bsdsignal.c
4 * Use sigaction() to simulate BSD signal()
5 */
7 #include "config.h"
9 void (*bsd_signal(int signum, void (*handler) (int))) (int) {
10 struct sigaction action, oldaction;
12 memset(&action, 0, sizeof action);
13 action.sa_handler = handler;
14 sigemptyset(&action.sa_mask);
15 sigaddset(&action.sa_mask, signum);
16 action.sa_flags = SA_RESTART;
18 if (sigaction(signum, &action, &oldaction) == -1) {
19 #ifdef SIG_ERR
20 return SIG_ERR;
21 #else
22 return NULL;
23 #endif
26 return oldaction.sa_handler;