aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-10-27 14:57:01 -0700
committerAndrew Kelley <andrew@ziglang.org>2025-10-29 06:20:51 -0700
commitef55dcae675dd2048e5e404eb8bb6833d153f653 (patch)
tree9b643e1c94a33958c5a22b1f5c524f0bd0a50e2a /lib/std
parentbbc1c075382b3fa9f275fac097267b7c61b5a899 (diff)
downloadzig-ef55dcae675dd2048e5e404eb8bb6833d153f653.tar.gz
zig-ef55dcae675dd2048e5e404eb8bb6833d153f653.zip
start: fix logic for signal hanlding when SIG.POLL does not exist
fixes a compilation failure on FreeBSD
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/start.zig16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig
index 09c1f3b5c4..20dd981707 100644
--- a/lib/std/start.zig
+++ b/lib/std/start.zig
@@ -784,9 +784,19 @@ fn maybeIgnoreSignals() void {
.mask = posix.sigemptyset(),
.flags = 0,
};
- if (!std.options.keep_sigpoll) posix.sigaction(posix.SIG.POLL, &act, null);
- if (@hasField(posix.SIG, "IO") and posix.SIG.IO != posix.SIG.POLL and !std.options.keep_sigio) posix.sigaction(posix.SIG.IO, &act, null);
- if (!std.options.keep_sigpipe) posix.sigaction(posix.SIG.PIPE, &act, null);
+
+ if (@hasField(posix.SIG, "POLL") and !std.options.keep_sigpoll)
+ posix.sigaction(posix.SIG.POLL, &act, null);
+
+ if (@hasField(posix.SIG, "IO") and
+ (!@hasField(posix.SIG, "POLL") or posix.SIG.IO != posix.SIG.POLL) and
+ !std.options.keep_sigio)
+ {
+ posix.sigaction(posix.SIG.IO, &act, null);
+ }
+
+ if (@hasField(posix.SIG, "PIPE") and !std.options.keep_sigpipe)
+ posix.sigaction(posix.SIG.PIPE, &act, null);
}
fn noopSigHandler(_: i32) callconv(.c) void {}