]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Wrap ASCTIME too
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 9 Sep 2013 23:41:50 +0000 (00:41 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 9 Sep 2013 23:42:19 +0000 (00:42 +0100)
src/include/missing-h
src/main/log.c

index 7e0be2224465e512ecb96a974d60f6a29139bcc5..0ab99a74a13a213609a93cb4bed60347676164d0 100644 (file)
@@ -4,7 +4,7 @@
 /*
  * missing.h   Replacements for functions that are or can be
  *             missing on some platforms.
- *             HAVE_* and WITH_* defines are substituted at 
+ *             HAVE_* and WITH_* defines are substituted at
  *             build time by make with values from autoconf.h.
  *
  * Version:    $Id$
@@ -359,14 +359,12 @@ int gettimeofday (struct timeval *tv, void *tz);
 /*
  *     Work around diffrent ctime_r styles
  */
-#ifdef CTIMERSTYLE
-#  if CTIMERSTYLE == SOLARISSTYLE
-#    define CTIME_R(a,b,c) ctime_r(a,b,c)
-#  else
-#    define CTIME_R(a,b,c) ctime_r(a,b)
-#  endif
+#if defined(CTIMERSTYLE) && (CTIMERSTYLE == SOLARISSTYLE)
+#define CTIME_R(a,b,c) ctime_r(a,b,c)
+#define ASCTIME_R(a,b,c) asctime_r(a,b,c)
 #else
-#  define CTIME_R(a,b,c) ctime_r(a,b)
+#define CTIME_R(a,b,c) ctime_r(a,b)
+#define ASCTIME_R(a,b,c) asctime_r(a,b)
 #endif
 
 #ifdef WIN32
index d31c11bf34f021e83c6eb8e77e5e3f1e21458b0a..e854ee91005e26c1c7d330e11cbd483e0135fa15 100644 (file)
@@ -427,11 +427,12 @@ void radlog_request(log_type_t type, log_debug_t lvl, REQUEST *request, char con
                if (log_dates_utc) {
                        struct tm utc;
                        gmtime_r(&timeval, &utc);
-                       asctime_r(&utc, buffer);
+                       ASCTIME_R(&utc, buffer, sizeof(buffer) - 1);
                } else
 #endif
+               {
                        CTIME_R(&timeval, buffer, sizeof(buffer) - 1);
-
+               }
                len = strlen(buffer);
                p = strrchr(buffer, '\n');
                if (p) {