Skip to content

Commit

Permalink
Check signal() return code
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasHabets committed Nov 12, 2019
1 parent 708c2ad commit 0e5a10f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "config.h"
#endif

#include <errno.h>
#include <signal.h>
#include <string.h>

Expand Down Expand Up @@ -104,7 +105,10 @@ arping_lookupdev_default(uint32_t srcip, uint32_t dstip, char *ebuf)
void
do_signal_init()
{
signal(SIGINT, sigint);
if (SIG_ERR == signal(SIGINT, sigint)) {
fprintf(stderr, "arping: failed to set SIGINT handler: %s\n",
strerror(errno));
}
}
/* ---- Emacs Variables ----
* Local Variables:
Expand Down

0 comments on commit 0e5a10f

Please sign in to comment.