*/
if (config->spawn_workers) {
INFO("All threads have exited, sending SIGTERM to remaining children");
+
+ /*
+ * If pid is negative, but not -1, sig
+ * shall be sent to all processes
+ * (excluding an unspecified set of system processes)
+ * whose process group ID is equal to the absolute value
+ * of pid, and for which the process has permission t
+ * to send a signal.
+ */
kill(-radius_pid, SIGTERM);
}
*/
static void sig_fatal(int sig)
{
+ static int last_sig;
+
if (getpid() != radius_pid) _exit(sig);
+ /*
+ * Suppress duplicate signals.
+ *
+ * For some reason on macOS we get multiple signals
+ * for the same event (SIGTERM).
+ *
+ * ...this also fixes the problem of the user hammering
+ * Ctrl-C and causing ungraceful exits as we try and
+ * write out signals to a pipe that's already closed.
+ */
+ if (sig == last_sig) return;
+ last_sig = sig;
+
switch (sig) {
case SIGTERM:
main_loop_signal_raise(RADIUS_SIGNAL_SELF_TERM);