summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-10-20 10:25:55 -0400
committerNick Mathewson <nickm@torproject.org>2017-10-20 11:39:17 -0400
commit9bafc3b1efd64b19695cd78fb51070ff8d3939f5 (patch)
treec18ef1fbd3e7c2884aa17fb1769378e7680b0a12 /src/or/main.c
parentc82cc8acb5aa43b3d96490d927dcc622f2c825e3 (diff)
downloadtor-9bafc3b1efd64b19695cd78fb51070ff8d3939f5.tar.gz
tor-9bafc3b1efd64b19695cd78fb51070ff8d3939f5.zip
Replace most bad exits in main.c, hibernate.c
This should make most of the reasons that we hibernate cleaner.
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/or/main.c b/src/or/main.c
index c3822dd94a..4d252faf20 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2776,14 +2776,13 @@ process_signal(int sig)
{
case SIGTERM:
log_notice(LD_GENERAL,"Catching signal TERM, exiting cleanly.");
- tor_cleanup();
- exit(0); // XXXX bad exit
+ tor_shutdown_event_loop_and_exit(0);
break;
case SIGINT:
if (!server_mode(get_options())) { /* do it now */
log_notice(LD_GENERAL,"Interrupt: exiting cleanly.");
- tor_cleanup();
- exit(0); // XXXX bad exit
+ tor_shutdown_event_loop_and_exit(0);
+ return;
}
#ifdef HAVE_SYSTEMD
sd_notify(0, "STOPPING=1");
@@ -2812,8 +2811,8 @@ process_signal(int sig)
#endif
if (do_hup() < 0) {
log_warn(LD_CONFIG,"Restart failed (config error?). Exiting.");
- tor_cleanup();
- exit(1); // XXXX bad exit
+ tor_shutdown_event_loop_and_exit(1);
+ return;
}
#ifdef HAVE_SYSTEMD
sd_notify(0, "READY=1");