mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-08-14 04:25:26 +00:00
Don't raise SIGPIPE, let errno be set to EPIPE. i.e. this fixes slirp ethernet
mode with no listening port on the remote host.
This commit is contained in:
@@ -47,6 +47,7 @@
|
|||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__))
|
#if defined(__FreeBSD__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__))
|
||||||
@@ -248,6 +249,16 @@ bool ether_init(void)
|
|||||||
else
|
else
|
||||||
net_if_type = NET_IF_SHEEPNET;
|
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
|
#ifdef HAVE_SLIRP
|
||||||
// Initialize slirp library
|
// Initialize slirp library
|
||||||
if (net_if_type == NET_IF_SLIRP) {
|
if (net_if_type == NET_IF_SLIRP) {
|
||||||
|
Reference in New Issue
Block a user