From 91a5df442f6cf1d93029c363b5c28ad6e56afd42 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Wed, 28 Oct 2009 11:09:15 +0100 Subject: [PATCH] Dropping non-strftime() support and fixing -Werror problem Problem: a) when running ./configure, strftime() and other functions cannot be properly detected, since autoconf generates crappy test code, which at least fails when warnings are treated as errors (gcc: -Werror). b) strtime() is standard since C89, so we can simply expect it to exists (if there's *really* some acient box out there breaking mc build, it's libc/toolchain should be fixed ;-p) Solution: Remove the checks for strftime() and all workarounds --- configure.ac | 2 +- src/timefmt.h | 12 ------------ vfs/samba/configure.ac | 2 +- vfs/samba/lib/time.c | 8 -------- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac index 0f1f86366..d1f6ae553 100644 --- a/configure.ac +++ b/configure.ac @@ -166,7 +166,7 @@ AC_CHECK_FUNCS([\ initgroups isascii \ memcpy memset \ putenv \ - setreuid setuid statfs strerror strftime sysconf \ + setreuid setuid statfs strerror sysconf \ tcgetattr tcsetattr truncate \ ]) diff --git a/src/timefmt.h b/src/timefmt.h index b93a13585..ef588670c 100644 --- a/src/timefmt.h +++ b/src/timefmt.h @@ -10,8 +10,6 @@ #define INVALID_TIME_TEXT "(invalid)" -#ifdef HAVE_STRFTIME - /* safe localtime formatting - strftime()-using version */ #define FMT_LOCALTIME(buffer, bufsize, fmt, when) \ { \ @@ -28,16 +26,6 @@ } \ } \ -#else - -/* fallback when strftime/localtime not available */ -#define FMT_LOCALTIME(buffer,bufsize,fmt,when) \ - { \ - ctime_r(when,buffer); \ - } \ - -#endif - #define FMT_LOCALTIME_CURRENT(buffer, bufsize, fmt) \ { \ time_t __current_time; \ diff --git a/vfs/samba/configure.ac b/vfs/samba/configure.ac index 3a9e1fbff..a6c5dbe0c 100644 --- a/vfs/samba/configure.ac +++ b/vfs/samba/configure.ac @@ -142,7 +142,7 @@ fi AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod) AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset) AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob pipe crypt16 getauthuid) -AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent) +AC_CHECK_FUNCS(sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent) AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf) AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups mktime rename ftruncate) AC_CHECK_FUNCS(grantpt dup2 yp_get_default_domain getpwanam) diff --git a/vfs/samba/lib/time.c b/vfs/samba/lib/time.c index c76af3b5d..088d6bcb5 100644 --- a/vfs/samba/lib/time.c +++ b/vfs/samba/lib/time.c @@ -493,11 +493,7 @@ char *http_timestring(time_t t) if (!tm) slprintf(buf,sizeof(buf)-1,"%ld seconds since the Epoch",(long)t); else -#ifndef HAVE_STRFTIME - fstrcpy(buf, asctime(tm)); -#else /* !HAVE_STRFTIME */ strftime(buf, sizeof(buf)-1, "%a, %d %b %Y %H:%M:%S %Z", tm); -#endif /* !HAVE_STRFTIME */ return buf; } #endif /*0 */ @@ -515,11 +511,7 @@ char *timestring(void ) if (!tm) { slprintf(TimeBuf,sizeof(TimeBuf)-1,"%ld seconds since the Epoch",(long)t); } else { -#ifdef HAVE_STRFTIME strftime(TimeBuf,100,"%Y/%m/%d %H:%M:%S",tm); -#else - fstrcpy(TimeBuf, asctime(tm)); -#endif } return(TimeBuf); }