]> granicus.if.org Git - fcron/commitdiff
better support of HP-UX : use sigset if signal doesn't exist
authorthib <thib>
Sat, 12 Mar 2005 12:39:21 +0000 (12:39 +0000)
committerthib <thib>
Sat, 12 Mar 2005 12:39:21 +0000 (12:39 +0000)
fcron.c

diff --git a/fcron.c b/fcron.c
index 53ccf59a69c6f29b2c22858e3c8fca28a336d99d..ac0ced1c3cd61ae0254c617c02d1654e65240387 100644 (file)
--- a/fcron.c
+++ b/fcron.c
@@ -21,7 +21,7 @@
  *  `LICENSE' that comes with the fcron source distribution.
  */
 
- /* $Id: fcron.c,v 1.72 2005-02-26 15:11:32 thib Exp $ */
+ /* $Id: fcron.c,v 1.73 2005-03-12 12:39:21 thib Exp $ */
 
 #include "fcron.h"
 
@@ -33,7 +33,7 @@
 #include "socket.h"
 #endif
 
-char rcs_info[] = "$Id: fcron.c,v 1.72 2005-02-26 15:11:32 thib Exp $";
+char rcs_info[] = "$Id: fcron.c,v 1.73 2005-03-12 12:39:21 thib Exp $";
 
 void main_loop(void);
 void check_signal(void);
@@ -571,14 +571,7 @@ main(int argc, char **argv)
 
     explain("%s[%d] " VERSION_QUOTED " started", prog_name, daemon_pid);
 
-#ifdef _HPUX_SOURCE
-    sigset(SIGTERM, sigterm_handler);
-    sigset(SIGHUP, sighup_handler);
-    sigset(SIGCHLD, sigchild_handler);
-    sigset(SIGUSR1, sigusr1_handler);
-    sigset(SIGUSR2, sigusr2_handler);
-    sigset(SIGPIPE, SIG_IGN);
-#else
+#ifdef HAVE_SIGNAL
     signal(SIGTERM, sigterm_handler);
     signal(SIGHUP, sighup_handler);
     siginterrupt(SIGHUP, 0);
@@ -590,6 +583,13 @@ main(int argc, char **argv)
     siginterrupt(SIGUSR2, 0);
     /* we don't want SIGPIPE to kill fcron, and don't need to handle it */
     signal(SIGPIPE, SIG_IGN);
+#elif HAVE_SIGSET
+    sigset(SIGTERM, sigterm_handler);
+    sigset(SIGHUP, sighup_handler);
+    sigset(SIGCHLD, sigchild_handler);
+    sigset(SIGUSR1, sigusr1_handler);
+    sigset(SIGUSR2, sigusr2_handler);
+    sigset(SIGPIPE, SIG_IGN);
 #endif
 
     /* initialize job database */
@@ -643,7 +643,7 @@ check_signal()
     if (sig_chld > 0) {
        wait_chld();
        sig_chld = 0;
-#ifndef _HPUX_SOURCE
+#ifdef HAVE_SIGNAL
        (void)signal(SIGCHLD, sigchild_handler);
        siginterrupt(SIGCHLD, 0);
 #endif
@@ -654,7 +654,7 @@ check_signal()
            /* update configuration */
            synchronize_dir(".");
            sig_conf = 0;
-#ifndef _HPUX_SOURCE
+#ifdef HAVE_SIGNAL
            signal(SIGHUP, sighup_handler);
            siginterrupt(SIGHUP, 0);
 #endif
@@ -663,7 +663,7 @@ check_signal()
            /* reload all configuration */
            reload_all(".");
            sig_conf = 0;
-#ifndef _HPUX_SOURCE
+#ifdef HAVE_SIGNAL
            signal(SIGUSR1, sigusr1_handler);
            siginterrupt(SIGUSR1, 0);
 #endif
@@ -675,7 +675,7 @@ check_signal()
        debug_opt = (debug_opt > 0)? 0 : 1;
        explain("debug_opt = %d", debug_opt);
        sig_debug = 0;
-#ifndef _HPUX_SOURCE
+#ifdef HAVE_SIGNAL
        signal(SIGUSR2, sigusr2_handler);
        siginterrupt(SIGUSR2, 0);
 #endif