diff options
Diffstat (limited to 'log-server.c')
-rw-r--r-- | log-server.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/log-server.c b/log-server.c index 6642dbedf..805df6b6f 100644 --- a/log-server.c +++ b/log-server.c | |||
@@ -15,7 +15,7 @@ to the system log. | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | RCSID("$Id: log-server.c,v 1.2 1999/11/11 06:57:39 damien Exp $"); | 18 | RCSID("$Id: log-server.c,v 1.3 1999/11/15 04:25:10 damien Exp $"); |
19 | 19 | ||
20 | #include <syslog.h> | 20 | #include <syslog.h> |
21 | #include "packet.h" | 21 | #include "packet.h" |
@@ -24,6 +24,7 @@ RCSID("$Id: log-server.c,v 1.2 1999/11/11 06:57:39 damien Exp $"); | |||
24 | 24 | ||
25 | static LogLevel log_level = SYSLOG_LEVEL_INFO; | 25 | static LogLevel log_level = SYSLOG_LEVEL_INFO; |
26 | static int log_on_stderr = 0; | 26 | static int log_on_stderr = 0; |
27 | static int log_facility = LOG_AUTH; | ||
27 | 28 | ||
28 | /* Initialize the log. | 29 | /* Initialize the log. |
29 | av0 program name (should be argv[0]) | 30 | av0 program name (should be argv[0]) |
@@ -33,7 +34,6 @@ static int log_on_stderr = 0; | |||
33 | 34 | ||
34 | void log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) | 35 | void log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) |
35 | { | 36 | { |
36 | int log_facility; | ||
37 | 37 | ||
38 | switch (level) | 38 | switch (level) |
39 | { | 39 | { |
@@ -93,8 +93,6 @@ void log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | log_on_stderr = on_stderr; | 95 | log_on_stderr = on_stderr; |
96 | closelog(); /* Close any previous log. */ | ||
97 | openlog(av0, LOG_PID, log_facility); | ||
98 | } | 96 | } |
99 | 97 | ||
100 | #define MSGBUFSIZE 1024 | 98 | #define MSGBUFSIZE 1024 |
@@ -106,6 +104,7 @@ do_log(LogLevel level, const char *fmt, va_list args) | |||
106 | char fmtbuf[MSGBUFSIZE]; | 104 | char fmtbuf[MSGBUFSIZE]; |
107 | char *txt = NULL; | 105 | char *txt = NULL; |
108 | int pri = LOG_INFO; | 106 | int pri = LOG_INFO; |
107 | extern char *__progname; | ||
109 | 108 | ||
110 | if (level > log_level) | 109 | if (level > log_level) |
111 | return; | 110 | return; |
@@ -143,5 +142,7 @@ do_log(LogLevel level, const char *fmt, va_list args) | |||
143 | } | 142 | } |
144 | if (log_on_stderr) | 143 | if (log_on_stderr) |
145 | fprintf(stderr, "%s\n", msgbuf); | 144 | fprintf(stderr, "%s\n", msgbuf); |
145 | openlog(__progname, LOG_PID, log_facility); | ||
146 | syslog(pri, "%.500s", msgbuf); | 146 | syslog(pri, "%.500s", msgbuf); |
147 | closelog(); | ||
147 | } | 148 | } |