From 2f1239a24df0df25b4c77bfd7449012977a6ee54 Mon Sep 17 00:00:00 2001
From: simonm <unknown>
Date: Mon, 25 Aug 1997 12:28:27 +0000
Subject: [PATCH] [project @ 1997-08-25 12:28:27 by simonm] Fix problem with
 installing signal handlers on FreeBSD. Symptom: occasional reports of 'cannot
 install SEGV handler...', sometimes when the Haskell program calls 'error'.

---
 ghc/runtime/main/Signals.lc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ghc/runtime/main/Signals.lc b/ghc/runtime/main/Signals.lc
index 858b40703f3b..97fb56b34d94 100644
--- a/ghc/runtime/main/Signals.lc
+++ b/ghc/runtime/main/Signals.lc
@@ -163,7 +163,9 @@ install_segv_handler(void)
     /* FreeBSD seems to generate SIGBUS for stack overflows */
     if (signal(SIGBUS, segv_handler) == SIG_ERR)
 	return -1;
-    return ((int) signal(SIGSEGV, segv_handler));
+    if (signal(SIGSEGV, segv_handler) == SIG_ERR)
+	return -1;
+    return 0;
 #else
     return ((int) signal(SIGSEGV, segv_handler) == SIG_ERR);
     /* I think the "== SIG_ERR" is saying "there was no
-- 
GitLab