diff options
author | teor <teor@torproject.org> | 2019-09-26 12:18:23 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-09-26 12:22:34 +1000 |
commit | 749c2e1761c753992fb2549e7ee912e568f563d6 (patch) | |
tree | 69a2e8b3cc359f5d7518d6bac09e415ae3d7bffd /src/lib/log | |
parent | 2f8a9a2db692a101b7e6241cbcdf9ed87841310b (diff) | |
download | tor-749c2e1761c753992fb2549e7ee912e568f563d6.tar.gz tor-749c2e1761c753992fb2549e7ee912e568f563d6.zip |
log: explain why it is safe to leave the log mutex initialized
The log mutex is dynamically initialized, guarded by log_mutex_initialized.
We don't want to destroy it, because after it is destroyed, we won't see
any more logs.
If tor is re-initialized, log_mutex_initialized will still be 1. So we
won't trigger any undefined behaviour by trying to re-initialize the
log mutex.
Part of 31736, but committed in this branch to avoid merge conflicts.
Diffstat (limited to 'src/lib/log')
-rw-r--r-- | src/lib/log/log.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/log/log.c b/src/lib/log/log.c index a9ad38fb25..eacd413a53 100644 --- a/src/lib/log/log.c +++ b/src/lib/log/log.c @@ -804,7 +804,10 @@ logs_free_all(void) } /* We _could_ destroy the log mutex here, but that would screw up any logs - * that happened between here and the end of execution. */ + * that happened between here and the end of execution. + * If tor is re-initialized, log_mutex_initialized will still be 1. So we + * won't trigger any undefined behaviour by trying to re-initialize the + * log mutex. */ } /** Remove and free the log entry <b>victim</b> from the linked-list |