diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-11-06 11:33:23 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-11-06 11:33:23 -0500 |
commit | 4d70e725d16abc2f85d54b91f50e75c37c765087 (patch) | |
tree | 9dc4815c94a9e05f11e61434d4c62ebd77bdd9d5 /src/lib/evloop/compat_libevent.c | |
parent | 1bde356bf645f3c3d3b0a6e70c03e2baf9f89d26 (diff) | |
download | tor-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/lib/evloop/compat_libevent.c')
-rw-r--r-- | src/lib/evloop/compat_libevent.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/evloop/compat_libevent.c b/src/lib/evloop/compat_libevent.c index 91eacb9938..939d77f857 100644 --- a/src/lib/evloop/compat_libevent.c +++ b/src/lib/evloop/compat_libevent.c @@ -181,6 +181,16 @@ tor_libevent_initialize(tor_libevent_cfg *torcfg) event_get_version(), tor_libevent_get_method()); } +/** + * Return true iff the libevent module has been successfully initialized, + * and not subsequently shut down. + **/ +bool +tor_libevent_is_initialized(void) +{ + return the_event_base != NULL; +} + /** Return the current Libevent event base that we're set up to use. */ MOCK_IMPL(struct event_base *, tor_libevent_get_base, (void)) |