From: Todd C. Miller Date: Sat, 18 Feb 2017 23:23:40 +0000 (-0700) Subject: strftime() was in C89 so use it unconditionally. X-Git-Tag: SUDO_1_8_20^2~99 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd40d88ba798b24d3ee37e214601b575a596b573;p=sudo strftime() was in C89 so use it unconditionally. --- diff --git a/config.h.in b/config.h.in index b5a86ebfd..c562be867 100644 --- a/config.h.in +++ b/config.h.in @@ -654,9 +654,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H -/* Define to 1 if you have the `strftime' function. */ -#undef HAVE_STRFTIME - /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H diff --git a/configure b/configure index edf2eeba1..13330a720 100755 --- a/configure +++ b/configure @@ -2847,7 +2847,6 @@ as_fn_append ac_header_list " sys/sysmacros.h" as_fn_append ac_func_list " fexecve" as_fn_append ac_func_list " killpg" as_fn_append ac_func_list " nl_langinfo" -as_fn_append ac_func_list " strftime" as_fn_append ac_func_list " pread" as_fn_append ac_func_list " pwrite" as_fn_append ac_func_list " openat" @@ -18692,8 +18691,6 @@ done - - case "$host_os" in hpux*) if test X"$ac_cv_func_pread" = X"yes"; then diff --git a/configure.ac b/configure.ac index ff8773132..763419473 100644 --- a/configure.ac +++ b/configure.ac @@ -2394,7 +2394,7 @@ dnl dnl Function checks dnl AC_FUNC_GETGROUPS -AC_CHECK_FUNCS_ONCE([fexecve killpg nl_langinfo strftime pread pwrite openat faccessat wordexp]) +AC_CHECK_FUNCS_ONCE([fexecve killpg nl_langinfo pread pwrite openat faccessat wordexp]) case "$host_os" in hpux*) if test X"$ac_cv_func_pread" = X"yes"; then diff --git a/plugins/sudoers/timestr.c b/plugins/sudoers/timestr.c index 06c4983d9..3cdb25af5 100644 --- a/plugins/sudoers/timestr.c +++ b/plugins/sudoers/timestr.c @@ -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; }