Non-threadsafe call to ctime()
authorScott Cantor <cantor.2@osu.edu>
Tue, 17 Oct 2006 16:42:35 +0000 (16:42 +0000)
committerScott Cantor <cantor.2@osu.edu>
Tue, 17 Oct 2006 16:42:35 +0000 (16:42 +0000)
config_win32.h
configure.ac
shib-target/shib-mlp.cpp

index 9df3d7e..d22c581 100644 (file)
@@ -19,6 +19,9 @@
 /* Define to 1 if you have the `gmtime_r' function. */
 /* #undef HAVE_GMTIME_R */
 
+/* Define to 1 if you have the `ctime_r' function. */
+/* #undef HAVE_CTIME_R */
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #define HAVE_INTTYPES_H 1
 
index 17c4903..302951a 100644 (file)
@@ -46,7 +46,7 @@ AC_STRUCT_TM
 # Checks for library functions.
 AC_FUNC_STRFTIME
 AC_FUNC_STRERROR_R
-AC_CHECK_FUNCS([strchr strdup strstr gmtime_r strtok_r strcasecmp])
+AC_CHECK_FUNCS([strchr strdup strstr gmtime_r ctime_r strtok_r strcasecmp])
 AC_CHECK_HEADERS([dlfcn.h])
 
 # old_LIBS="$LIBS"
index bc9567a..de25e65 100644 (file)
@@ -101,7 +101,12 @@ const char* ShibMLP::run(const string& is, const IPropertySet* props, std::strin
 {
   // Create a timestamp
   time_t now = time(NULL);
+#ifdef HAVE_CTIME_R
+  char timebuf[32];
+  insert("now", ctime_r(&now,timebuf));
+#else
   insert("now", ctime(&now));
+#endif
 
   if (!output)
     output=&m_generated;