Bandaid for a seg fault i just got in 0.1.1.20.

More generally, i reopened bug 222. Whee.


svn:r6571
This commit is contained in:
Roger Dingledine 2006-06-09 06:35:45 +00:00
parent a91be49402
commit 85d408a573

View File

@ -327,9 +327,12 @@ close_logs(void)
} }
/** Remove and free the log entry <b>victim</b> from the linked-list /** Remove and free the log entry <b>victim</b> from the linked-list
* logfiles (it must be present in the list when this function is * logfiles (it is probably present, but it might not be due to thread
* called). After this function is called, the caller shouldn't refer * racing issues). After this function is called, the caller shouldn't
* to <b>victim</b> anymore. * refer to <b>victim</b> anymore.
*
* Long-term, we need to do something about races in the log subsystem
* in general. See bug 222 for more details.
*/ */
static void static void
delete_log(logfile_t *victim) delete_log(logfile_t *victim)
@ -339,8 +342,10 @@ delete_log(logfile_t *victim)
logfiles = victim->next; logfiles = victim->next;
else { else {
for (tmpl = logfiles; tmpl && tmpl->next != victim; tmpl=tmpl->next) ; for (tmpl = logfiles; tmpl && tmpl->next != victim; tmpl=tmpl->next) ;
tor_assert(tmpl); // tor_assert(tmpl);
tor_assert(tmpl->next == victim); // tor_assert(tmpl->next == victim);
if (!tmpl)
return;
tmpl->next = victim->next; tmpl->next = victim->next;
} }
tor_free(victim->filename); tor_free(victim->filename);