[Git][NTPsec/ntpsec][master] Remove ifdefs on SIGxxx

Hal Murray gitlab at mg.gitlab.com
Wed Sep 14 05:07:38 UTC 2016


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
3d6bd5a0 by Hal Murray at 2016-09-13T22:07:16-07:00
Remove ifdefs on SIGxxx

They are in Posix.

- - - - -


2 changed files:

- libntp/work_thread.c
- ntpd/ntpd.c


Changes:

=====================================
libntp/work_thread.c
=====================================
--- a/libntp/work_thread.c
+++ b/libntp/work_thread.c
@@ -448,18 +448,10 @@ block_thread_signals(
 	sigaddset(&block, SIGALRM);
 	sigaddset(&block, MOREDEBUGSIG);
 	sigaddset(&block, LESSDEBUGSIG);
-# ifdef SIGINT
 	sigaddset(&block, SIGINT);
-# endif 
-# ifdef SIGQUIT
 	sigaddset(&block, SIGQUIT);
-# endif
-# ifdef SIGTERM
 	sigaddset(&block, SIGTERM);
-# endif
-# ifdef SIGBUS
 	sigaddset(&block, SIGBUS);
-# endif
 	sigemptyset(pmask);
 	pthread_sigmask(SIG_BLOCK, &block, pmask);
 }


=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -37,12 +37,10 @@ extern bool sandbox(const bool droproot,
 		    const char *chrootdir,
 		    bool want_dynamic_interface_tracking);
 
-#if defined(SIGINT) || defined(SIGQUIT) || defined(SIGTERM)
 static volatile bool signalled	= false;
 static volatile int signo	= 0;
 /* In an ideal world, 'finish_safe()' would declared as noreturn... */
 static	void		finish_safe	(int);
-#endif
 
 #ifdef SIGDANGER
 # include <ulimit.h>
@@ -689,21 +687,11 @@ ntpdmain(
 	/*
 	 * Set up signals we pay attention to locally.
 	 */
-# ifdef SIGINT
 	signal_no_reset(SIGINT, finish);
-# endif
-# ifdef SIGQUIT
 	signal_no_reset(SIGQUIT, finish);
-# endif
-# ifdef SIGTERM
 	signal_no_reset(SIGTERM, finish);
-# endif
-# ifdef SIGHUP
 	signal_no_reset(SIGHUP, catchHUP);
-# endif
-# ifdef SIGBUS
-	signal_no_reset(SIGBUS, finish);
-# endif
+	signal_no_reset(SIGBUS, finish);  /* FIXME: It's broken, can't continue. */
 
 # ifdef DEBUG
 	(void) signal_no_reset(MOREDEBUGSIG, moredebug);
@@ -716,9 +704,7 @@ ntpdmain(
 	/*
 	 * Set up signals we should never pay attention to.
 	 */
-# ifdef SIGPIPE
 	signal_no_reset(SIGPIPE, SIG_IGN);
-# endif
 
 	/*
 	 * Call the init_ routines to initialize the data structures.
@@ -934,10 +920,8 @@ static void mainloop(void)
 	was_alarmed = false;
 
 	for (;;) {
-#if defined(SIGINT) || defined(SIGQUIT) || defined(SIGTERM)
 		if (signalled)
 			finish_safe(signo);
-#endif
 		if (alarm_flag) {	/* alarmed? */
 			was_alarmed = true;
 			alarm_flag = false;
@@ -1062,7 +1046,6 @@ static void mainloop(void)
 }
 
 
-#if defined(SIGINT) || defined(SIGQUIT) || defined(SIGTERM)
 /*
  * finish - exit gracefully
  */
@@ -1105,8 +1088,6 @@ static void catchHUP(int sig)
 	sawHUP = true;
 }
 
-#endif	/* defined(SIGINT) || defined(SIGQUIT) || defined(SIGTERM) */
-
 
 /*
  * wait_child_sync_if - implements parent side of -w/--wait-sync



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3d6bd5a07938204edf1604129179ac4ed41450aa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160914/14e8b133/attachment.html>


More information about the vc mailing list