MCPcopy Create free account
hub / github.com/eggert/tz / catch_signals

Function catch_signals

zic.c:1099–1131  ·  view source on GitHub ↗

Arrange for SIGINT etc. to be caught by the handler. */

Source from the content-addressed store, hash-verified

1097static void
1098catch_signals(void)
1099{
1100 static int const signals[] = {
1101#ifdef SIGHUP
1102 SIGHUP,
1103#endif
1104 SIGINT,
1105#ifdef SIGPIPE
1106 SIGPIPE,
1107#endif
1108 SIGTERM
1109 };
1110 int i;
1111 for (i = 0; i < sizeof signals / sizeof signals[0]; i++) {
1112#ifdef SA_SIGINFO
1113 struct sigaction act0, act;
1114 act.sa_handler = signal_handler;
1115 sigemptyset(&act.sa_mask);
1116 act.sa_flags = 0;
1117 if (sigaction(signals[i], &act, &act0) == 0
1118 && ! (act0.sa_flags & SA_SIGINFO) && act0.sa_handler == SIG_IGN) {
1119 sigaction(signals[i], &act0, NULL);
1120 got_signal = 0;
1121 }
1122#else
1123 if (signal(signals[i], signal_handler) == SIG_IGN) {
1124 signal(signals[i], SIG_IGN);
1125 got_signal = 0;
1126 }
1127#endif
1128 }
1129}
1130
1131/* If a signal has arrived, terminate zic with appropriate status. */
1132static void
1133check_for_signal(void)
1134{

Callers 1

mainFunction · 0.85

Calls 1

sigactionClass · 0.85

Tested by

no test coverage detected