From 95671469c75cb56e7bdee9a061bc20114b4c2dc0 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 7 Nov 2024 14:34:11 +0100 Subject: [PATCH] runtime: use SA_RESTART when registering a signal This really is the only sane way to register a signal. If this flag is not set, many syscalls will return EINTR (and not complete their operation) which will be a massive source of hard-to-debug bugs. --- src/runtime/signal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runtime/signal.c b/src/runtime/signal.c index a462518c1..ba4338a6d 100644 --- a/src/runtime/signal.c +++ b/src/runtime/signal.c @@ -15,6 +15,7 @@ void tinygo_signal_handler(int sig); void tinygo_signal_enable(uint32_t sig) { struct sigaction act = { 0 }; act.sa_handler = &tinygo_signal_handler; + act.sa_flags = SA_RESTART; sigaction(sig, &act, NULL); }