]> andersk Git - openssh.git/blobdiff - log-server.c
- Applied Tom Bertelson's <tbert@abac.com> AIX authentication fix
[openssh.git] / log-server.c
index 3776f109504e599dfe32479a9507041733938fad..86fcf2a114db1ed3c6b05ea039a7b3e98c1c841a 100644 (file)
@@ -1,17 +1,17 @@
 /*
- * 
+ *
  * log-server.c
- * 
+ *
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
- * 
+ *
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
- * 
+ *
  * Created: Mon Mar 20 21:19:30 1995 ylo
- * 
+ *
  * Server-side versions of debug(), log(), etc.  These normally send the output
  * to the system log.
- * 
+ *
  */
 
 #include "includes.h"
@@ -25,7 +25,7 @@ RCSID("$Id$");
 #ifdef HAVE___PROGNAME
 extern char *__progname;
 #else /* HAVE___PROGNAME */
-const char *__progname = "sshd";
+static const char *__progname = "sshd";
 #endif /* HAVE___PROGNAME */
 
 static LogLevel log_level = SYSLOG_LEVEL_INFO;
@@ -38,7 +38,7 @@ static int log_facility = LOG_AUTH;
  *   level     logging level
  */
 
-void 
+void
 log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr)
 {
        switch (level) {
@@ -97,13 +97,13 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr)
        log_on_stderr = on_stderr;
 }
 
-#define SSH_MSGBUFSIZE 1024
+#define MSGBUFSIZ 1024
 
 void
 do_log(LogLevel level, const char *fmt, va_list args)
 {
-       char msgbuf[SSH_MSGBUFSIZE];
-       char fmtbuf[SSH_MSGBUFSIZE];
+       char msgbuf[MSGBUFSIZ];
+       char fmtbuf[MSGBUFSIZ];
        char *txt = NULL;
        int pri = LOG_INFO;
 
@@ -137,9 +137,11 @@ do_log(LogLevel level, const char *fmt, va_list args)
        } else {
                vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
        }
-       if (log_on_stderr)
+       if (log_on_stderr) {
                fprintf(stderr, "%s\n", msgbuf);
-       openlog(__progname, LOG_PID, log_facility);
-       syslog(pri, "%.500s", msgbuf);
-       closelog();
+       } else {
+               openlog(__progname, LOG_PID, log_facility);
+               syslog(pri, "%.500s", msgbuf);
+               closelog();
+       }
 }
This page took 0.290864 seconds and 4 git commands to generate.