]> git.sur5r.net Git - openldap/blobdiff - libraries/liblutil/csn.c
ITS#4206: s/ACCRIGHTS/ACCRIGHTSLEN/
[openldap] / libraries / liblutil / csn.c
index 62247fd098c232ca6bb3ba71b08ea65994174cd5..4dcfc68079480bece55aafccf20769fc872f4395 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2003 The OpenLDAP Foundation.
+ * Copyright 2000-2005 The OpenLDAP Foundation.
  * Portions Copyright 2000-2003 Kurt D. Zeilenga.
  * All rights reserved.
  *
@@ -57,6 +57,9 @@ lutil_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod)
        time_t t;
        unsigned int op;
        struct tm *ltm;
+#ifdef HAVE_GMTIME_R
+       struct tm ltm_buf;
+#endif
        int n;
 
        time( &t );
@@ -64,9 +67,13 @@ lutil_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod)
                csntime = t;
                csnop = 0;
        }
-       op = ++csnop;
+       op = csnop++;
 
+#ifdef HAVE_GMTIME_R
+       ltm = gmtime_r( &t, &ltm_buf );
+#else
        ltm = gmtime( &t );
+#endif
        n = snprintf( buf, len,
                "%4d%02d%02d%02d%02d%02dZ#%06x#%02x#%06x",
            ltm->tm_year + 1900, ltm->tm_mon + 1, ltm->tm_mday, ltm->tm_hour,