summaryrefslogtreecommitdiffhomepage
path: root/src/main.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-11-04 00:42:05 +0100
committerMichael Adam <obnox@samba.org>2009-11-14 12:13:10 +0100
commitea2eaef173b56213fe58f42b9478164f7abdbfb7 (patch)
tree68d3abb8e22e0f1269e3547acbf9a864da476f37 /src/main.c
parentd8da7f55f7111174c49d716046d997f7b7f23f59 (diff)
extract setup of the logging subsystem into a function of its own.
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/main.c b/src/main.c
index ef46d00..b00e359 100644
--- a/src/main.c
+++ b/src/main.c
@@ -305,6 +305,7 @@ int
main (int argc, char **argv)
{
FILE *config_file;
+ int ret;
/* Only allow u+rw bits. This may be required for some versions
* of glibc so that mkstemp() doesn't make us vulnerable.
@@ -340,23 +341,8 @@ main (int argc, char **argv)
fclose (config_file);
- /* 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 (config.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]);
+ ret = setup_logging ();
+ if (ret != 0) {
exit (EX_SOFTWARE);
}