forked from mirrors/tftp-hpa-google
Portability improvements. Now compiles and works on Solaris 8, as well
as Linux.
This commit is contained in:
parent
4003a672ce
commit
266427bc5b
10 changed files with 78 additions and 29 deletions
|
@ -8,14 +8,23 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void bsd_signal(int signum, void (*handler)(int))
|
||||
void (*bsd_signal(int signum, void (*handler)(int)))(int);
|
||||
{
|
||||
struct sigaction action;
|
||||
struct sigaction action, oldaction;
|
||||
|
||||
memset(&action, 0, sizeof action);
|
||||
action.sa_handler = handler;
|
||||
sigemptyset(&action.sa_mask);
|
||||
sigaddset(&act.sa_mask, signum);
|
||||
action.sa_flags = SA_RESTART;
|
||||
|
||||
sigaction(hander, action, NULL);
|
||||
if (sigaction(hander, action, &oldaction) == -1) {
|
||||
#ifdef SIG_ERR
|
||||
return SIG_ERR;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
return oldaction.sa_handler;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue