[BACK]Return to log.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/log.c between version 1.24 and 1.24.2.2

version 1.24, 2002/07/19 15:43:33 version 1.24.2.2, 2003/09/16 21:20:26
Line 40 
Line 40 
 #include "xmalloc.h"  #include "xmalloc.h"
   
 #include <syslog.h>  #include <syslog.h>
   #include <vis.h>
   
 static LogLevel log_level = SYSLOG_LEVEL_INFO;  static LogLevel log_level = SYSLOG_LEVEL_INFO;
 static int log_on_stderr = 1;  static int log_on_stderr = 1;
Line 124 
Line 125 
 /* Log this message (information that usually should go to the log). */  /* Log this message (information that usually should go to the log). */
   
 void  void
 log(const char *fmt,...)  logit(const char *fmt,...)
 {  {
         va_list args;          va_list args;
   
Line 230 
Line 231 
                 next_cu = cu->next;                  next_cu = cu->next;
                 xfree(cu);                  xfree(cu);
         }          }
           fatal_cleanups = NULL;
 }  }
   
 /* Cleanup and exit */  /* Cleanup and exit */
Line 330 
Line 332 
 void  void
 do_log(LogLevel level, const char *fmt, va_list args)  do_log(LogLevel level, const char *fmt, va_list args)
 {  {
           struct syslog_data sdata = SYSLOG_DATA_INIT;
         char msgbuf[MSGBUFSIZ];          char msgbuf[MSGBUFSIZ];
         char fmtbuf[MSGBUFSIZ];          char fmtbuf[MSGBUFSIZ];
         char *txt = NULL;          char *txt = NULL;
Line 378 
Line 381 
         } else {          } else {
                 vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);                  vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
         }          }
           strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_SAFE|VIS_OCTAL);
         if (log_on_stderr) {          if (log_on_stderr) {
                 fprintf(stderr, "%s\r\n", msgbuf);                  snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf);
                   write(STDERR_FILENO, msgbuf, strlen(msgbuf));
         } else {          } else {
                 openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility);                  openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata);
                 syslog(pri, "%.500s", msgbuf);                  syslog_r(pri, &sdata, "%.500s", fmtbuf);
                 closelog();                  closelog_r(&sdata);
         }          }
 }  }

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.24.2.2