From cfdf4fa5f17eb423d07a8c555d36c5c8c5e5988c Mon Sep 17 00:00:00 2001
From: Emmanuel Charpentier <emm.charpentier@free.fr>
Date: Wed, 14 Mar 2018 19:30:37 +0100
Subject: [PATCH 8/9] parent_sig_handler

make sure the parent_sig_handler function is defined before getting used.

---
 src/library/parallel/src/fork.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/library/parallel/src/fork.c b/src/library/parallel/src/fork.c
index ef04e1f..bc02722 100644
--- a/src/library/parallel/src/fork.c
+++ b/src/library/parallel/src/fork.c
@@ -227,15 +227,15 @@ static void setup_sig_handler() {
 #else
 /* sigaction is not viable, so use the "dumb" way
    to clean up anything that comes our way */
-static void setup_sig_handler() {
-    signal(SIGCHLD, parent_sig_handler);
-}
-
 static void parent_sig_handler(int sig) {
     /* clean up when a child terminates */
     if (sig == SIGCHLD)
 	clean_zombies();
 }
+
+static void setup_sig_handler() {
+    signal(SIGCHLD, parent_sig_handler);
+}
 #endif
 
 SEXP mc_fork(SEXP sEstranged)
-- 
2.16.1

