From: Wilfried Göesgens Date: Mon, 1 Mar 2010 20:50:38 +0000 (+0000) Subject: * add configure detection for solaris localtime_r, it needs to know the size of the... X-Git-Tag: v7.86~349 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=3f48719ddbbbedb9e876df0407052c4f54b57548 * add configure detection for solaris localtime_r, it needs to know the size of the buffer --- diff --git a/webcit/configure.ac b/webcit/configure.ac index 53a13c0d0..5fe05bc1f 100644 --- a/webcit/configure.ac +++ b/webcit/configure.ac @@ -88,6 +88,33 @@ dnl Checks for header files. AC_HEADER_STDC dnl AC_HEADER_SYS_WAIT +AC_CACHE_CHECK( + [for call semantics from getpwuid_r], + ac_cv_call_getpwuid_r, + [AC_TRY_COMPILE([#include +#include ], + [ + struct passwd pw, *pwp; + char pwbuf[64]; + uid_t uid; + + getpwuid_r(uid, &pw, pwbuf, sizeof(pwbuf), &pwp); + ], + ac_cv_call_getpwuid_r=yes, + ac_cv_call_getpwuid_r=no) + ]) + +if test $ac_cv_call_getpwuid_r = no; then + AC_DEFINE(SOLARIS_GETPWUID,[],[do we need to use solaris call syntax?]) + AC_DEFINE(SOLARIS_LOCALTIME_R,[], [do we need to use soralis call syntax?]) + AC_DEFINE(F_UID_T, "%ld", [whats the matching format string for uid_t?]) + AC_DEFINE(F_PID_T, "%ld", [whats the matching format string for pid_t?]) + AC_DEFINE(F_XPID_T, "%lx", [whats the matching format string for xpid_t?]) +else + AC_DEFINE(F_UID_T, "%d", [whats the matching format string for uid_t?]) + AC_DEFINE(F_PID_T, "%d", [whats the matching format string for pid_t?]) + AC_DEFINE(F_XPID_T, "%x", [whats the matching format string for xpid_t?]) +fi diff --git a/webcit/http_datestring.c b/webcit/http_datestring.c index 2e2bef8da..50cfae68f 100644 --- a/webcit/http_datestring.c +++ b/webcit/http_datestring.c @@ -71,7 +71,11 @@ void tmplput_nowstr(StrBuf *Target, WCTemplputParams *TP) time_t now; now = time(NULL); +#ifdef HAVE_SOLARIS_LOCALTIME_R + asctime_r(localtime(&now), buf, sizeof(buf)); +#else asctime_r(localtime(&now), buf); +#endif bufused = strlen(buf); if ((bufused > 0) && (buf[bufused - 1] == '\n')) { buf[bufused - 1] = '\0';