Skip to content

Commit

Permalink
Merge pull request cebix#256 from rakslice/ether_ignore_other_sigpipe…
Browse files Browse the repository at this point in the history
…_handler

Do not treat it as an error when ignoring SIGPIPE if there is already a handler installed
  • Loading branch information
kanjitalk755 authored Jan 23, 2025
2 parents e5d6fe4 + 01dc76b commit e9c5e21
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions BasiliskII/src/Unix/ether_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,14 @@ bool ether_init(void)
// 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);
if (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);
}
// If something else in the process has installed a SIGPIPE handler (SDL kmsdrm?),
// and wants to eat our unwanted signals instead, that's fine too.
}

#ifdef HAVE_SLIRP
Expand Down

0 comments on commit e9c5e21

Please sign in to comment.