hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit a0efbe96bd9fa845c1d61ec405fe0d65d86bc72a
parent dfb88eea79e53f3a60a6452b6e32e612bd52edc9
Author: Alexey Yerin <yyp@disroot.org>
Date:   Sun,  3 Sep 2023 16:23:27 +0300

unix::signal: Set SA_SIGINFO by default

Hare uses a three-argument signal handler, but doesn't tell the kernel to do so.
Because of this, reading from siginfo or ucontext will return random data
(Linux) or segfault (FreeBSD).

Signed-off-by: Alexey Yerin <yyp@disroot.org>

Diffstat:
Munix/signal/+freebsd.ha | 2+-
Munix/signal/+linux.ha | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/unix/signal/+freebsd.ha b/unix/signal/+freebsd.ha @@ -14,7 +14,7 @@ export fn handle( ) sigaction = { let sa_mask = newsigset(); - let sa_flags = 0, nmask = 0; + let sa_flags = rt::SA_SIGINFO: int, nmask = 0; for (let i = 0z; i < len(opt); i += 1) { match (opt[i]) { case let flag: flag => diff --git a/unix/signal/+linux.ha b/unix/signal/+linux.ha @@ -17,7 +17,7 @@ export fn handle( ) sigaction = { let sa_mask = newsigset(); - let sa_flags = 0u64, nmask = 0; + let sa_flags = rt::SA_SIGINFO, nmask = 0; for (let i = 0z; i < len(opt); i += 1) { match (opt[i]) { case let flag: flag =>