summaryrefslogtreecommitdiffhomepage
path: root/src/tinyproxy.c
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2002-10-03 20:53:11 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2002-10-03 20:53:11 +0000
commit1d39f204cad86a8f78af3fa904cbbb510eb22b72 (patch)
treeb1defc2fae98588708eb99fce46f29e1d708f028 /src/tinyproxy.c
parent745c40650be6926eae5088c8485d25b679c72aaa (diff)
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.
Diffstat (limited to 'src/tinyproxy.c')
-rw-r--r--src/tinyproxy.c17
1 files changed, 13 insertions, 4 deletions
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);
}