r18018: Fix the build on OpenBSD. No license problem this time, I've written strnlen
authorVolker Lendecke <vlendec@samba.org>
Sun, 3 Sep 2006 16:33:12 +0000 (16:33 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:17:03 +0000 (14:17 -0500)
from scratch.

Volker

source/lib/ldb/replace/replace.c
source/lib/replace/replace.c

index faa5771a76c51d7490412ebadd6ffee62643c8a1..a63613fc1057b303c2f97936f2746af69057739d 100644 (file)
@@ -23,7 +23,7 @@
 #include "includes.h"
 #include "ldb/include/includes.h"
 
-#ifndef HAVE_STRNLEN
+#if !defined(HAVE_STRNLEN) && !defined(_SAMBA_BUILD_)
 /**
  Some platforms don't have strnlen
 **/
index b8f4bc1c3c9eb15b516750db4e8e8a8767d4ad22..4048fe558e3ac60229e44e49ed6ef0d3dc6d8ce3 100644 (file)
@@ -367,7 +367,23 @@ duplicate a string
 #endif /* HAVE_SYSLOG */
 #endif /* HAVE_VSYSLOG */
 
-
+#ifndef HAVE_STRNLEN
+/**
+ Some platforms don't have strnlen
+**/
+ size_t strnlen(const char *s, size_t max)
+{
+        size_t len;
+  
+        for (len = 0; len < max; len++) {
+                if (s[len] == '\0') {
+                        break;
+                }
+        }
+        return len;  
+}
+#endif
+  
 #ifndef HAVE_STRNDUP
 /**
  Some platforms don't have strndup.