summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-12-22 13:11:55 +0100
committerMichael Adam <obnox@samba.org>2009-12-23 00:27:26 +0100
commit891846f23e3e10e301743376f073991dac41c13e (patch)
treefd23ebe4d4a9d70ac1cdd174c9accd7b20d3da14
parent649b2c06830fe08cc9db5f6fdf6f05de96ed1a0b (diff)
downloadtinyproxy-891846f23e3e10e301743376f073991dac41c13e.tar.gz
tinyproxy-891846f23e3e10e301743376f073991dac41c13e.zip
log: add boolean local variable logging_initialized.
This controls whether log_messages should write to the log file / syslog or rather to the log_message_storage. This will make the global processed_config_file variable from main unneccessary in the next step. Michael
-rw-r--r--src/log.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/log.c b/src/log.c
index 3b5c706..066dff2 100644
--- a/src/log.c
+++ b/src/log.c
@@ -62,6 +62,8 @@ static int log_level = LOG_INFO;
*/
static vector_t log_message_storage;
+static unsigned int logging_initialized = FALSE; /* boolean */
+
/*
* Open the log file and store the file descriptor in a global location.
*/
@@ -137,7 +139,7 @@ void log_message (int level, const char *fmt, ...)
* If the config file hasn't been processed, then we need to store
* the messages for later processing.
*/
- if (!processed_config_file) {
+ if (!logging_initialized) {
char *entry_buffer;
if (!log_message_storage) {
@@ -276,6 +278,7 @@ int setup_logging (void)
goto done;
}
+ logging_initialized = TRUE;
ret = 0;
done:
@@ -295,4 +298,6 @@ void shutdown_logging (void)
fprintf (stderr, "error - shutdown_logging called while "
" logging not configured yet\n");
}
+
+ logging_initialized = FALSE;
}