From 01fae602425b91647b54888c82450091d4c89714 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 8 Sep 2009 16:36:32 -0400 Subject: [PATCH] Windows: Use secure ctime and strncpy in afs_ctime Microsoft compilers version 1400 and above provide secure versions of ctime and strncpy. Use them in afs_ctime. Correction to sha1:359c64bb674ea0606e64b91fd8252297310a9862 Thanks to Andrew Deason for identifing the mistake. Reviewed-on: http://gerrit.openafs.org/429 Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- src/util/afsutil.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/afsutil.h b/src/util/afsutil.h index 177a3f2..5b73ad4 100644 --- a/src/util/afsutil.h +++ b/src/util/afsutil.h @@ -91,13 +91,13 @@ extern char *vctime(const time_t * atime); #else /* AFS_PTHREAD_ENV && !AFS_NT40_ENV */ static_inline char * afs_ctime(const time_t *C, char *B, size_t S) { -#if !defined(AFS_NT40_ENV) || (_MSC_VER < 1500) +#if !defined(AFS_NT40_ENV) || (_MSC_VER < 1400) strncpy(B, ctime(C), (S-1)); B[S-1] = '\0'; #else char buf[32]; if (ctime_s(buf, sizeof(buf), C) || - strncpy_s(B, S, buf, _TRUNCATE) + strncpy_s(B, S, buf, _TRUNCATE)) B[0] = '\0'; #endif return B; -- 1.9.4