From af5e519e8e72c37b732474e08b6648bbdf458e95 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Sat, 19 Jul 2008 07:41:06 +0000 Subject: [PATCH 1/1] always-wrap-vos-ctime-20080718 LICENSE MIT When calling ctime on an afs_int32, always use a wrapper that assigns the variable to a time_t before passing it in rather than conditionally doing so on hosts with a large time_t. This eliminates a configure test, removes a bunch of warnings in vos.c on platforms with 32-bit time_t, and will make no difference in generated code with any decent compiler. --- acconfig.h | 1 - acinclude.m4 | 15 --------------- src/volser/vos.c | 4 ---- 3 files changed, 20 deletions(-) diff --git a/acconfig.h b/acconfig.h index 948ce06..ab3fe15 100644 --- a/acconfig.h +++ b/acconfig.h @@ -70,7 +70,6 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } #undef STRUCT_TASK_STRUCT_HAS_SIGHAND #undef STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK #undef ssize_t -#undef SIZEOF_TIME_T #undef HAVE_STRUCT_BUF #undef HAVE_ARPA_NAMESER_COMPAT_H /* glue for RedHat kernel bug */ diff --git a/acinclude.m4 b/acinclude.m4 index 89b00b8..6396257 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1413,21 +1413,6 @@ AC_CHECK_TYPE([sig_atomic_t], , #include ]) AC_SIZEOF_TYPE(long) -AC_MSG_CHECKING(size of time_t) -AC_CACHE_VAL(ac_cv_sizeof_time_t, -[AC_TRY_RUN([#include -#include -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(time_t)); - exit(0); -}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0) -]) -AC_MSG_RESULT($ac_cv_sizeof_time_t) -AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t) - AC_CHECK_FUNCS(timegm) AC_CHECK_FUNCS(daemon) diff --git a/src/volser/vos.c b/src/volser/vos.c index 84e7720..30fbc83 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -472,16 +472,12 @@ DumpFunction(struct rx_call *call, char *filename) return (error); } -#if SIZEOF_TIME_T!=4 static char * vos_ctime(afs_int32 *timep) { time_t foo = *timep; return ctime(&foo); } -#else -#define vos_ctime ctime -#endif static void DisplayFormat(pntr, server, part, totalOK, totalNotOK, totalBusy, fast, -- 1.9.4