Skip to content

Commit 890b19a

Browse files
committed
On OCaml 5, use SA_ONSTACK to avoid corrupting memory
Fixes #981.
1 parent cc05e2b commit 890b19a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/unix/lwt_unix_stubs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,11 @@ CAMLprim value lwt_unix_set_signal(value val_signum, value val_notification) {
840840
}
841841
#else
842842
sa.sa_handler = handle_signal;
843+
#if OCAML_VERSION >= 50000
844+
sa.sa_flags = SA_ONSTACK;
845+
#else
843846
sa.sa_flags = 0;
847+
#endif
844848
sigemptyset(&sa.sa_mask);
845849
if (sigaction(signum, &sa, NULL) == -1) {
846850
signal_notifications[signum] = -1;

0 commit comments

Comments
 (0)