--- embedaddon/sudo/plugins/sudoers/timestr.c 2013/07/22 10:46:12 1.1.1.1 +++ embedaddon/sudo/plugins/sudoers/timestr.c 2013/10/14 07:56:35 1.1.1.2 @@ -33,7 +33,7 @@ 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(). */ char * @@ -45,14 +45,11 @@ get_timestr(time_t tstamp, int log_year) struct tm *timeptr; 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. */ 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; #endif /* HAVE_STRFTIME */