47 |
|
#include <semaphore.h> |
48 |
|
#include <errno.h> |
49 |
|
#include <stdio.h> |
50 |
+ |
#include <signal.h> |
51 |
|
#include <map> |
52 |
|
|
53 |
|
#if defined(__FreeBSD__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__)) |
249 |
|
else |
250 |
|
net_if_type = NET_IF_SHEEPNET; |
251 |
|
|
252 |
+ |
// Don't raise SIGPIPE, let errno be set to EPIPE |
253 |
+ |
struct sigaction sigpipe_sa; |
254 |
+ |
if (sigaction(SIGPIPE, NULL, &sigpipe_sa) == 0) { |
255 |
+ |
assert(sigpipe_sa.sa_handler == SIG_DFL || sigpipe_sa.sa_handler == SIG_IGN); |
256 |
+ |
sigfillset(&sigpipe_sa.sa_mask); |
257 |
+ |
sigpipe_sa.sa_flags = 0; |
258 |
+ |
sigpipe_sa.sa_handler = SIG_IGN; |
259 |
+ |
sigaction(SIGPIPE, &sigpipe_sa, NULL); |
260 |
+ |
} |
261 |
+ |
|
262 |
|
#ifdef HAVE_SLIRP |
263 |
|
// Initialize slirp library |
264 |
|
if (net_if_type == NET_IF_SLIRP) { |