forked from mirrors/tftp-hpa-google
signals: require and always use sigaction()
tftpd already requires sigaction() to compile, so there is no reason to use anything else. It also allows for nicer combination of flags. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
e52af4207a
commit
33051a296c
6 changed files with 22 additions and 55 deletions
14
tftpd/misc.c
14
tftpd/misc.c
|
@ -19,19 +19,11 @@
|
|||
#include "tftpd.h"
|
||||
|
||||
/*
|
||||
* Set the signal handler and flags. Basically a user-friendly
|
||||
* wrapper around sigaction().
|
||||
* Set the signal handler and flags, and error out on failure.
|
||||
*/
|
||||
void set_signal(int signum, void (*handler) (int), int flags)
|
||||
void set_signal(int signum, sighandler_t handler, int flags)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
memset(&sa, 0, sizeof sa);
|
||||
sa.sa_handler = handler;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = flags;
|
||||
|
||||
if (sigaction(signum, &sa, NULL)) {
|
||||
if (tftp_signal(signum, handler, flags)) {
|
||||
syslog(LOG_ERR, "sigaction: %m");
|
||||
exit(EX_OSERR);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue