2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-05 16:55:57 +00:00

strftime() was in C89 so use it unconditionally.

This commit is contained in:
Todd C. Miller
2017-02-18 16:23:40 -07:00
parent e5dee1557e
commit fd40d88ba7
4 changed files with 2 additions and 23 deletions

View File

@@ -28,13 +28,10 @@
/*
* Return a static buffer with the current date + time.
* Uses strftime() if available, else falls back to ctime().
*/
char *
get_timestr(time_t tstamp, int log_year)
{
char *s;
#ifdef HAVE_STRFTIME
static char buf[128];
struct tm *timeptr;
@@ -45,17 +42,5 @@ get_timestr(time_t tstamp, int log_year)
timeptr) != 0 && buf[sizeof(buf) - 1] == '\0')
return buf;
}
#endif /* HAVE_STRFTIME */
s = ctime(&tstamp);
if (s != NULL) {
s += 4; /* skip day of the week */
if (log_year)
s[20] = '\0'; /* avoid the newline */
else
s[15] = '\0'; /* don't care about year */
}
return s;
return NULL;
}