summaryrefslogtreecommitdiff
path: root/src/common/log.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-05-29 18:21:00 +0000
committerNick Mathewson <nickm@torproject.org>2007-05-29 18:21:00 +0000
commite5ed434c42cd379847bff63851bd623b252c25a3 (patch)
tree7c85dcd5bc54d37cdbfc7f5e6aa11911663f734f /src/common/log.c
parent9d1af71b70d7f7253976e97633fd4d1e1d395d77 (diff)
downloadtor-e5ed434c42cd379847bff63851bd623b252c25a3.tar.gz
tor-e5ed434c42cd379847bff63851bd623b252c25a3.zip
r13054@catbus: nickm | 2007-05-29 14:20:50 -0400
An even better workaround for the probably-already-fixed bug 222. svn:r10395
Diffstat (limited to 'src/common/log.c')
-rw-r--r--src/common/log.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/common/log.c b/src/common/log.c
index ac28830dfa..a10f00854e 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -35,6 +35,7 @@ typedef struct logfile_t {
struct logfile_t *next; /**< Next logfile_t in the linked list. */
char *filename; /**< Filename to open. */
FILE *file; /**< Stream to receive log messages. */
+ int seems_dead; /**< Boolean: true if the stream seems to be kaput. */
int needs_close; /**< Boolean: true if the stream gets closed on shutdown. */
int min_loglevel; /**< Lowest severity level to send to this stream. */
int max_loglevel; /**< Highest severity level to send to this stream. */
@@ -247,6 +248,10 @@ logv(int severity, uint32_t domain, const char *funcname, const char *format,
lf = lf->next;
continue;
}
+ if (lf->seems_dead) {
+ lf = lf->next;
+ continue;
+ }
if (!formatted) {
end_of_prefix =
@@ -268,13 +273,11 @@ logv(int severity, uint32_t domain, const char *funcname, const char *format,
}
if (fputs(buf, lf->file) == EOF ||
fflush(lf->file) == EOF) { /* error */
- /* don't log the error! Blow away this log entry and continue. */
- logfile_t *victim = lf;
- lf = victim->next;
- delete_log(victim);
- } else {
- lf = lf->next;
+ /* don't log the error! mark this log entry to be blown away, and
+ * continue. */
+ lf->seems_dead = 1;
}
+ lf = lf->next;
}
}