aboutsummaryrefslogtreecommitdiff
path: root/src/core/mainloop/mainloop.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-11-06 11:33:23 -0500
committerNick Mathewson <nickm@torproject.org>2019-11-06 11:33:23 -0500
commit4d70e725d16abc2f85d54b91f50e75c37c765087 (patch)
tree9dc4815c94a9e05f11e61434d4c62ebd77bdd9d5 /src/core/mainloop/mainloop.c
parent1bde356bf645f3c3d3b0a6e70c03e2baf9f89d26 (diff)
downloadtor-4d70e725d16abc2f85d54b91f50e75c37c765087.tar.gz
tor-4d70e725d16abc2f85d54b91f50e75c37c765087.zip
Do not try to shut down the event loop when it is not initialized.
Doing so caused us to crash in some unusual circumstances, such as using --verify-config to verify a configuration that failed during the options_act() stage. Fixes bug 32407; bugfix on 0.3.3.1-alpha.
Diffstat (limited to 'src/core/mainloop/mainloop.c')
-rw-r--r--src/core/mainloop/mainloop.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 6e2b300fb4..64df495ba0 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -774,6 +774,10 @@ tor_shutdown_event_loop_and_exit(int exitcode)
main_loop_should_exit = 1;
main_loop_exit_value = exitcode;
+ if (! tor_libevent_is_initialized()) {
+ return; /* No event loop to shut down. */
+ }
+
/* Die with an assertion failure in ten seconds, if for some reason we don't
* exit normally. */
/* XXXX We should consider this code if it's never used. */