aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-06-02 19:18:37 +0000
committerNick Mathewson <nickm@torproject.org>2004-06-02 19:18:37 +0000
commit605e10a650ee05c9b019ff3b8f4edfb3b6ad8f16 (patch)
treecba37b9f2d3509355cd8496fc0b1b10a0a730596 /src
parent69931106f898aecb60d503d6e10e3aa118961c29 (diff)
downloadtor-605e10a650ee05c9b019ff3b8f4edfb3b6ad8f16.tar
tor-605e10a650ee05c9b019ff3b8f4edfb3b6ad8f16.tar.gz
Stop multiplying logs on sighup.
svn:r1936
Diffstat (limited to 'src')
-rw-r--r--src/common/log.c7
-rw-r--r--src/common/log.h1
-rw-r--r--src/or/main.c1
3 files changed, 9 insertions, 0 deletions
diff --git a/src/common/log.c b/src/common/log.c
index f3c7281b1..3e55501dd 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -205,6 +205,13 @@ void close_temp_logs(void)
}
}
+void mark_logs_temp(void)
+{
+ logfile_t *lf;
+ for (lf = logfiles; lf; lf = lf->next)
+ lf->is_temporary = 1;
+}
+
/**
* Add a log handler to send messages to <b>filename</b>. If opening
* the logfile fails, -1 is returned and errno is set appropriately
diff --git a/src/common/log.h b/src/common/log.h
index 33e42b7d4..7ce5ceee0 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -54,6 +54,7 @@ void close_logs();
void reset_logs();
void add_temp_log(void);
void close_temp_logs(void);
+void mark_logs_temp(void);
/* Outputs a message to stdout */
void _log(int severity, const char *format, ...) CHECK_PRINTF(2,3);
diff --git a/src/or/main.c b/src/or/main.c
index b63dd1439..7f2c309c0 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -608,6 +608,7 @@ static int do_hup(void) {
log_fn(LOG_NOTICE,"Received sighup. Reloading config.");
has_completed_circuit=0;
+ mark_logs_temp(); /* Close current logs once new logs are open. */
/* first, reload config variables, in case they've changed */
/* no need to provide argc/v, they've been cached inside init_from_config */
if (init_from_config(0, NULL) < 0) {