[shibboleth-sp2] 111/119: Test for ctime_r prototype.

Ferenc Wágner wferi-guest at moszumanska.debian.org
Tue Jan 26 21:29:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

wferi-guest pushed a commit to annotated tag 1.3.1
in repository shibboleth-sp2.

commit 4bdcdf182ecebe853d8465b74dba6a19a6d9a11a
Author: Scott Cantor <cantor.2 at osu.edu>
Date:   Thu Nov 15 23:15:09 2007 +0000

    Test for ctime_r prototype.
---
 configure.ac             | 32 +++++++++++++++++++++++++++++++-
 shib-target/shib-mlp.cpp | 11 +++++++----
 2 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1331876..ed44933 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 ctime_r strtok_r strcasecmp])
+AC_CHECK_FUNCS([strchr strdup strstr gmtime_r strtok_r strcasecmp])
 AC_CHECK_HEADERS([dlfcn.h])
 
 # old_LIBS="$LIBS"
@@ -66,6 +66,36 @@ else
     CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
 fi
 
+# Thank you Solaris, really.
+AC_MSG_CHECKING(for ctime_r)
+ if test -z "$ac_cv_ctime_args"; then
+     AC_TRY_COMPILE(
+     [#include <time.h>],
+     [
+         time_t clock;
+         char buf[26];
+         ctime_r(&clock, buf);
+     ], ac_cv_ctime_args=2)
+
+     AC_TRY_COMPILE(
+     [#include <time.h>],
+     [
+         time_t clock;
+         char buf[26];
+         ctime_r(&clock, buf, 26);
+     ], ac_cv_ctime_args=3)
+ fi
+ if test -z "$ac_cv_ctime_args"; then
+     AC_MSG_RESULT(no)
+ else
+     if test "$ac_cv_ctime_args" = 2; then
+         AC_DEFINE(HAVE_CTIME_R_2,1,[Define if ctime_r is present with 2 parameters.])
+     elif test "$ac_cv_ctime_args" = 3; then
+         AC_DEFINE(HAVE_CTIME_R_3,1,[Define if ctime_r is present with 3 parameters.])
+     fi
+     AC_MSG_RESULT([yes, and it takes $ac_cv_ctime_args arguments])
+ fi 
+
 # Test RPC now -- finish dealing with it later
 AC_ARG_ENABLE(native-rpc,
 	AC_HELP_STRING([--enable-native-rpc], [use the OS-supplied Sun RPC library, default is NO, except Linux]),
diff --git a/shib-target/shib-mlp.cpp b/shib-target/shib-mlp.cpp
index 59f4606..403f237 100644
--- a/shib-target/shib-mlp.cpp
+++ b/shib-target/shib-mlp.cpp
@@ -77,11 +77,14 @@ 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,sizeof(timebuf)));
+#if defined(HAVE_CTIME_R_2)
+    char timebuf[32];
+    insert("now", ctime_r(&now,timebuf));
+#elif defined(HAVE_CTIME_R_3)
+    char timebuf[32];
+    insert("now", ctime_r(&now,timebuf,sizeof(timebuf)));
 #else
-  insert("now", ctime(&now));
+    insert("now", ctime(&now));
 #endif
 
   if (!output)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-shibboleth/shibboleth-sp2.git



More information about the Pkg-shibboleth-devel mailing list