summaryrefslogtreecommitdiffhomepage
path: root/src/tinyproxy.c
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2004-08-14 03:21:28 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2004-08-14 03:21:28 +0000
commit93fbb5ff49b94860da6fe493ffc444effc20976d (patch)
tree5d146e754674512d20f02a0d8063ecfdbefb5646 /src/tinyproxy.c
parent5c0293953382f8a85311c623ed18707f48bd7853 (diff)
Changed the calls to the config_compile() and config_parse()
functions. Also, if the "logfile" directive is used, it will now override use of the syslog system. Added an error message if neither is defined.
Diffstat (limited to 'src/tinyproxy.c')
-rw-r--r--src/tinyproxy.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/tinyproxy.c b/src/tinyproxy.c
index 8c57a32..ab2b49c 100644
--- a/src/tinyproxy.c
+++ b/src/tinyproxy.c
@@ -1,4 +1,4 @@
-/* $Id: tinyproxy.c,v 1.48 2004-08-13 21:03:11 rjkaes Exp $
+/* $Id: tinyproxy.c,v 1.49 2004-08-14 03:21:28 rjkaes Exp $
*
* The initialize routine. Basically sets up all the initial stuff (logfile,
* listening socket, config options, etc.) and then sits there and loops
@@ -218,35 +218,36 @@ main(int argc, char **argv)
argv[0], config.config_file);
exit(EX_SOFTWARE);
}
- config_compile();
- if (config_parse(&config, config_file) != 0) {
+ if (config_compile() || config_parse(&config, config_file)) {
fprintf(stderr,
"Unable to parse configuration file. Not starting.\n");
exit(EX_SOFTWARE);
}
fclose(config_file);
- /* Open the log file if not using syslog */
- if (config.syslog == FALSE) {
- if (!config.logf_name) {
- fprintf(stderr,
- "%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 {
+ /*
+ * Write to a user supplied log file if it's defined. This
+ * will override using the syslog even if syslog is defined.
+ */
+ if (config.logf_name) {
+ if (open_log_file(config.logf_name) < 0) {
+ fprintf(stderr,
+ "%s: Could not create log file.\n",
+ argv[0]);
+ exit(EX_SOFTWARE);
+ }
+ config.syslog = FALSE; /* disable syslog */
+ } else if (config.syslog) {
if (godaemon == TRUE)
openlog("tinyproxy", LOG_PID, LOG_DAEMON);
else
openlog("tinyproxy", LOG_PID, LOG_USER);
- }
+ } else {
+ fprintf(stderr,
+ "%s: Either define a logfile or enable syslog logging\n",
+ argv[0]);
+ exit(EX_SOFTWARE);
+ }
processed_config_file = TRUE;
send_stored_logs();