mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Exit immediately if we can't monitor our owning controller process
tor_process_monitor_new can't currently return NULL, but if it ever can, we want that to be an explicitly fatal error, without relying on the fact that monitor_owning_controller_process's chain of caller will exit if it fails.
This commit is contained in:
parent
0caa37db4d
commit
b3133d1cad
@ -1232,10 +1232,7 @@ options_act(or_options_t *old_options)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitor_owning_controller_process(options->OwningControllerProcess)) {
|
monitor_owning_controller_process(options->OwningControllerProcess);
|
||||||
log_warn(LD_CONFIG, "Error monitoring owning controller process");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* reload keys as needed for rendezvous services. */
|
/* reload keys as needed for rendezvous services. */
|
||||||
if (rend_service_load_keys()<0) {
|
if (rend_service_load_keys()<0) {
|
||||||
|
@ -3815,8 +3815,8 @@ owning_controller_procmon_cb(void *unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Set <b>process_spec</b> as Tor's owning controller process.
|
/** Set <b>process_spec</b> as Tor's owning controller process.
|
||||||
* Return 0 on success, -1 on failure. */
|
* Exit on failure. */
|
||||||
int
|
void
|
||||||
monitor_owning_controller_process(const char *process_spec)
|
monitor_owning_controller_process(const char *process_spec)
|
||||||
{
|
{
|
||||||
const char *msg;
|
const char *msg;
|
||||||
@ -3829,7 +3829,7 @@ monitor_owning_controller_process(const char *process_spec)
|
|||||||
owning_controller_process_spec)) {
|
owning_controller_process_spec)) {
|
||||||
/* Same process -- return now, instead of disposing of and
|
/* Same process -- return now, instead of disposing of and
|
||||||
* recreating the process-termination monitor. */
|
* recreating the process-termination monitor. */
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We are currently owned by a process, and we should no longer be
|
/* We are currently owned by a process, and we should no longer be
|
||||||
@ -3845,7 +3845,7 @@ monitor_owning_controller_process(const char *process_spec)
|
|||||||
(owning_controller_process_monitor == NULL));
|
(owning_controller_process_monitor == NULL));
|
||||||
|
|
||||||
if (process_spec == NULL)
|
if (process_spec == NULL)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
owning_controller_process_spec = tor_strdup(process_spec);
|
owning_controller_process_spec = tor_strdup(process_spec);
|
||||||
owning_controller_process_monitor =
|
owning_controller_process_monitor =
|
||||||
@ -3856,13 +3856,13 @@ monitor_owning_controller_process(const char *process_spec)
|
|||||||
&msg);
|
&msg);
|
||||||
|
|
||||||
if (owning_controller_process_monitor == NULL) {
|
if (owning_controller_process_monitor == NULL) {
|
||||||
log_warn(LD_CONTROL, "Couldn't create process-termination monitor for "
|
log_err(LD_BUG, "Couldn't create process-termination monitor for "
|
||||||
"owning controller: %s",
|
"owning controller: %s. Exiting.",
|
||||||
msg);
|
msg);
|
||||||
return -1;
|
owning_controller_process_spec = NULL;
|
||||||
|
tor_cleanup();
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Convert the name of a bootstrapping phase <b>s</b> into strings
|
/** Convert the name of a bootstrapping phase <b>s</b> into strings
|
||||||
|
@ -70,7 +70,7 @@ smartlist_t *decode_hashed_passwords(config_line_t *passwords);
|
|||||||
void disable_control_logging(void);
|
void disable_control_logging(void);
|
||||||
void enable_control_logging(void);
|
void enable_control_logging(void);
|
||||||
|
|
||||||
int monitor_owning_controller_process(const char *process_spec);
|
void monitor_owning_controller_process(const char *process_spec);
|
||||||
|
|
||||||
void control_event_bootstrap(bootstrap_status_t status, int progress);
|
void control_event_bootstrap(bootstrap_status_t status, int progress);
|
||||||
void control_event_bootstrap_problem(const char *warn, int reason);
|
void control_event_bootstrap_problem(const char *warn, int reason);
|
||||||
|
Loading…
Reference in New Issue
Block a user