From: Scott Cantor Date: Tue, 17 Oct 2006 16:42:35 +0000 (+0000) Subject: Non-threadsafe call to ctime() X-Git-Tag: 1.3.1~123 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-sp.git;a=commitdiff_plain;h=0d890581b1f34f5774d34cf2d995bc010e52447f Non-threadsafe call to ctime() --- diff --git a/config_win32.h b/config_win32.h index 9df3d7e..d22c581 100644 --- a/config_win32.h +++ b/config_win32.h @@ -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 header file. */ #define HAVE_INTTYPES_H 1 diff --git a/configure.ac b/configure.ac index 17c4903..302951a 100644 --- a/configure.ac +++ b/configure.ac @@ -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" diff --git a/shib-target/shib-mlp.cpp b/shib-target/shib-mlp.cpp index bc9567a..de25e65 100644 --- a/shib-target/shib-mlp.cpp +++ b/shib-target/shib-mlp.cpp @@ -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;