diff --git a/BasiliskII/src/Unix/ether_unix.cpp b/BasiliskII/src/Unix/ether_unix.cpp index 787f6873..42643729 100644 --- a/BasiliskII/src/Unix/ether_unix.cpp +++ b/BasiliskII/src/Unix/ether_unix.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #if defined(__FreeBSD__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__)) @@ -248,6 +249,16 @@ bool ether_init(void) else net_if_type = NET_IF_SHEEPNET; + // Don't raise SIGPIPE, let errno be set to EPIPE + struct sigaction sigpipe_sa; + if (sigaction(SIGPIPE, NULL, &sigpipe_sa) == 0) { + assert(sigpipe_sa.sa_handler == SIG_DFL || sigpipe_sa.sa_handler == SIG_IGN); + sigfillset(&sigpipe_sa.sa_mask); + sigpipe_sa.sa_flags = 0; + sigpipe_sa.sa_handler = SIG_IGN; + sigaction(SIGPIPE, &sigpipe_sa, NULL); + } + #ifdef HAVE_SLIRP // Initialize slirp library if (net_if_type == NET_IF_SLIRP) {