From 1d39f204cad86a8f78af3fa904cbbb510eb22b72 Mon Sep 17 00:00:00 2001 From: Robert James Kaes Date: Thu, 3 Oct 2002 20:53:11 +0000 Subject: Fixed up the storing and sending of the internal tinyproxy logs prior to when the log file is created. Also, the log file is created with the proper owner permissions. --- src/tinyproxy.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/tinyproxy.c b/src/tinyproxy.c index ded63c7..614926d 100644 --- a/src/tinyproxy.c +++ b/src/tinyproxy.c @@ -1,4 +1,4 @@ -/* $Id: tinyproxy.c,v 1.38 2002-07-12 17:02:02 rjkaes Exp $ +/* $Id: tinyproxy.c,v 1.39 2002-10-03 20:53:11 rjkaes Exp $ * * The initialize routine. Basically sets up all the initial stuff (logfile, * listening socket, config options, etc.) and then sits there and loops @@ -230,6 +230,13 @@ main(int argc, char **argv) "%s: You MUST set a LogFile in the configuration file.\n", argv[0]); exit(EX_SOFTWARE); + } else { + if (open_log_file(config.logf_name) < 0) { + fprintf(stderr, + "%s: Could not create log file.\n", + argv[0]); + exit(EX_SOFTWARE); + } } } else { if (godaemon == TRUE) @@ -238,6 +245,9 @@ main(int argc, char **argv) openlog("tinyproxy", LOG_PID, LOG_USER); } + processed_config_file = TRUE; + send_stored_logs(); + /* * Set the default values if they were not set in the config file. */ @@ -352,9 +362,6 @@ main(int argc, char **argv) exit(EX_SOFTWARE); } - processed_config_file = TRUE; - send_stored_logs(); - /* * These signals are only for the parent process. */ @@ -407,6 +414,8 @@ main(int argc, char **argv) if (config.syslog) closelog(); + else + close_log_file(); exit(EX_OK); } -- cgit v1.2.3