Fix a rare infinite-recursion bug when shutting down.
commit9d11827780d15d8b398d8ce6b04110a4dea5e980
authorNick Mathewson <nickm@torproject.org>
Thu, 20 Aug 2009 15:51:34 +0000 (20 11:51 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 20 Aug 2009 15:55:33 +0000 (20 11:55 -0400)
tree54e6dc83f381e1595cfb286be3bf078807736d9e
parentc9b8a4a133780cb2ab3847292284a6e9292b70d1
Fix a rare infinite-recursion bug when shutting down.

Once we had called log_free_all(), anything that tried to log a
message (like a failed tor_assert()) would fail like this:

   1. The logging call eventually invokes the _log() function.
   2. _log() calls tor_mutex_lock(log_mutex).
   3. tor_mutex_lock(m) calls tor_assert(m).
   4. Since we freed the log_mutex, tor_assert() fails, and tries to
      log its failure.
   5. GOTO 1.

Now we allocate the mutex statically, and never destroy it on
shutdown.

Bugfix on 0.2.0.16-alpha, which introduced the log mutex.

This bug was found by Matt Edman.
ChangeLog
src/common/log.c