]> git.sur5r.net Git - openldap/blobdiff - libraries/liblutil/csn.c
Fix up abandon merge. Hallvard will holler if I get this wrong. :-)
[openldap] / libraries / liblutil / csn.c
index 9c9273772418be53d3ff6d6285583cc89c98d95f..33907102e1b436a592cfcb564e1aea63526ba2ae 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /* Portions
@@ -32,6 +32,8 @@
 #include <stdio.h>
 #include <ac/time.h>
 
+#include <lutil.h>
+
 size_t
 lutil_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod)
 {
@@ -55,7 +57,8 @@ lutil_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod)
            ltm->tm_year + 1900, ltm->tm_mon, ltm->tm_mday, ltm->tm_hour,
            ltm->tm_min, ltm->tm_sec, op, replica, mod );
 
-       return ( n < len ) ? n : 0;
+       if( n < 0 ) return 0;
+       return ( (size_t) n < len ) ? n : 0;
 }
 
 #ifdef TEST