[tor-commits] [tor/master] Remove the unused is_parent==0 option from handle_signals.
nickm at torproject.org
nickm at torproject.org
Fri Jan 19 21:35:36 UTC 2018
commit fdd5734875a49c4bfdebde45189038dd42306504
Author: Nick Mathewson <nickm at torproject.org>
Date: Fri Dec 15 12:45:30 2017 -0500
Remove the unused is_parent==0 option from handle_signals.
---
src/or/main.c | 56 +++++++++++++++++++-------------------------------------
src/or/main.h | 2 +-
2 files changed, 20 insertions(+), 38 deletions(-)
diff --git a/src/or/main.c b/src/or/main.c
index aae98dd8a..38f25cae5 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2530,7 +2530,7 @@ do_main_loop(void)
}
}
- handle_signals(1);
+ handle_signals();
monotime_init();
timers_initialize();
@@ -3052,46 +3052,28 @@ static struct {
{ -1, -1, NULL }
};
-/** Set up the signal handlers for either parent or child process */
+/** Set up the signal handlers for this process. */
void
-handle_signals(int is_parent)
+handle_signals(void)
{
int i;
- if (is_parent) {
- for (i = 0; signal_handlers[i].signal_value >= 0; ++i) {
- if (signal_handlers[i].try_to_register) {
- signal_handlers[i].signal_event =
- tor_evsignal_new(tor_libevent_get_base(),
- signal_handlers[i].signal_value,
- signal_callback,
- &signal_handlers[i].signal_value);
- if (event_add(signal_handlers[i].signal_event, NULL))
- log_warn(LD_BUG, "Error from libevent when adding "
- "event for signal %d",
- signal_handlers[i].signal_value);
- } else {
- signal_handlers[i].signal_event =
- tor_event_new(tor_libevent_get_base(), -1,
- EV_SIGNAL, signal_callback,
- &signal_handlers[i].signal_value);
- }
+ for (i = 0; signal_handlers[i].signal_value >= 0; ++i) {
+ if (signal_handlers[i].try_to_register) {
+ signal_handlers[i].signal_event =
+ tor_evsignal_new(tor_libevent_get_base(),
+ signal_handlers[i].signal_value,
+ signal_callback,
+ &signal_handlers[i].signal_value);
+ if (event_add(signal_handlers[i].signal_event, NULL))
+ log_warn(LD_BUG, "Error from libevent when adding "
+ "event for signal %d",
+ signal_handlers[i].signal_value);
+ } else {
+ signal_handlers[i].signal_event =
+ tor_event_new(tor_libevent_get_base(), -1,
+ EV_SIGNAL, signal_callback,
+ &signal_handlers[i].signal_value);
}
- } else {
-#ifndef _WIN32
- struct sigaction action;
- action.sa_flags = 0;
- sigemptyset(&action.sa_mask);
- action.sa_handler = SIG_IGN;
- sigaction(SIGINT, &action, NULL);
- sigaction(SIGTERM, &action, NULL);
- sigaction(SIGPIPE, &action, NULL);
- sigaction(SIGUSR1, &action, NULL);
- sigaction(SIGUSR2, &action, NULL);
- sigaction(SIGHUP, &action, NULL);
-#ifdef SIGXFSZ
- sigaction(SIGXFSZ, &action, NULL);
-#endif
-#endif /* !defined(_WIN32) */
}
}
diff --git a/src/or/main.h b/src/or/main.h
index 8eb977575..49292f80a 100644
--- a/src/or/main.h
+++ b/src/or/main.h
@@ -66,7 +66,7 @@ MOCK_DECL(long,get_uptime,(void));
unsigned get_signewnym_epoch(void);
-void handle_signals(int is_parent);
+void handle_signals(void);
void activate_signal(int signal_num);
int try_locking(const or_options_t *options, int err_if_locked);
More information about the tor-commits
mailing list