Diff for /embedaddon/sudo/plugins/sudoers/timestr.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2013/07/22 10:46:12 version 1.1.1.2, 2013/10/14 07:56:35
Line 33 Line 33
 char *get_timestr(time_t, int);  char *get_timestr(time_t, int);
   
 /*  /*
 * Return an ascii string with the current date + time * Return a static buffer with the current date + time.
  * Uses strftime() if available, else falls back to ctime().   * Uses strftime() if available, else falls back to ctime().
  */   */
 char *  char *
Line 45  get_timestr(time_t tstamp, int log_year) Line 45  get_timestr(time_t tstamp, int log_year)
     struct tm *timeptr;      struct tm *timeptr;
   
     timeptr = localtime(&tstamp);      timeptr = localtime(&tstamp);
     if (log_year)  
         s = "%h %e %T %Y";  
     else  
         s = "%h %e %T";  
   
     /* strftime() does not guarantee to NUL-terminate so we must check. */      /* strftime() does not guarantee to NUL-terminate so we must check. */
     buf[sizeof(buf) - 1] = '\0';      buf[sizeof(buf) - 1] = '\0';
    if (strftime(buf, sizeof(buf), s, timeptr) && buf[sizeof(buf) - 1] == '\0')    if (strftime(buf, sizeof(buf), log_year ? "%h %e %T %Y" : "%h %e %T",
         timeptr) != 0 && buf[sizeof(buf) - 1] == '\0')
         return buf;          return buf;
   
 #endif /* HAVE_STRFTIME */  #endif /* HAVE_STRFTIME */

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>