mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 13:43:47 +01:00
Remove the unused is_parent==0 option from handle_signals.
This commit is contained in:
parent
a61c36d53a
commit
fdd5734875
@ -2530,7 +2530,7 @@ do_main_loop(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_signals(1);
|
handle_signals();
|
||||||
monotime_init();
|
monotime_init();
|
||||||
timers_initialize();
|
timers_initialize();
|
||||||
|
|
||||||
@ -3052,46 +3052,28 @@ static struct {
|
|||||||
{ -1, -1, NULL }
|
{ -1, -1, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Set up the signal handlers for either parent or child process */
|
/** Set up the signal handlers for this process. */
|
||||||
void
|
void
|
||||||
handle_signals(int is_parent)
|
handle_signals(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (is_parent) {
|
for (i = 0; signal_handlers[i].signal_value >= 0; ++i) {
|
||||||
for (i = 0; signal_handlers[i].signal_value >= 0; ++i) {
|
if (signal_handlers[i].try_to_register) {
|
||||||
if (signal_handlers[i].try_to_register) {
|
signal_handlers[i].signal_event =
|
||||||
signal_handlers[i].signal_event =
|
tor_evsignal_new(tor_libevent_get_base(),
|
||||||
tor_evsignal_new(tor_libevent_get_base(),
|
signal_handlers[i].signal_value,
|
||||||
signal_handlers[i].signal_value,
|
signal_callback,
|
||||||
signal_callback,
|
&signal_handlers[i].signal_value);
|
||||||
&signal_handlers[i].signal_value);
|
if (event_add(signal_handlers[i].signal_event, NULL))
|
||||||
if (event_add(signal_handlers[i].signal_event, NULL))
|
log_warn(LD_BUG, "Error from libevent when adding "
|
||||||
log_warn(LD_BUG, "Error from libevent when adding "
|
"event for signal %d",
|
||||||
"event for signal %d",
|
signal_handlers[i].signal_value);
|
||||||
signal_handlers[i].signal_value);
|
} else {
|
||||||
} else {
|
signal_handlers[i].signal_event =
|
||||||
signal_handlers[i].signal_event =
|
tor_event_new(tor_libevent_get_base(), -1,
|
||||||
tor_event_new(tor_libevent_get_base(), -1,
|
EV_SIGNAL, signal_callback,
|
||||||
EV_SIGNAL, signal_callback,
|
&signal_handlers[i].signal_value);
|
||||||
&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) */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ MOCK_DECL(long,get_uptime,(void));
|
|||||||
|
|
||||||
unsigned get_signewnym_epoch(void);
|
unsigned get_signewnym_epoch(void);
|
||||||
|
|
||||||
void handle_signals(int is_parent);
|
void handle_signals(void);
|
||||||
void activate_signal(int signal_num);
|
void activate_signal(int signal_num);
|
||||||
|
|
||||||
int try_locking(const or_options_t *options, int err_if_locked);
|
int try_locking(const or_options_t *options, int err_if_locked);
|
||||||
|
Loading…
Reference in New Issue
Block a user