diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-09-03 16:33:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:17:03 -0500 |
commit | 515067a02eb03242411c8af4642265784af8d177 (patch) | |
tree | 7823e91d482856b88f496e50d8892fd4019913e1 /source4 | |
parent | 92b8f4cfb6d32a90e5b4b956824b25fa2d9efe42 (diff) | |
download | samba-515067a02eb03242411c8af4642265784af8d177.tar.gz samba-515067a02eb03242411c8af4642265784af8d177.tar.bz2 samba-515067a02eb03242411c8af4642265784af8d177.zip |
r18018: Fix the build on OpenBSD. No license problem this time, I've written strnlen
from scratch.
Volker
(This used to be commit 2a7cdf52e4113db30a7a8b180c68cec736f6c186)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/replace/replace.c | 2 | ||||
-rw-r--r-- | source4/lib/replace/replace.c | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/source4/lib/ldb/replace/replace.c b/source4/lib/ldb/replace/replace.c index faa5771a76..a63613fc10 100644 --- a/source4/lib/ldb/replace/replace.c +++ b/source4/lib/ldb/replace/replace.c @@ -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 **/ diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c index b8f4bc1c3c..4048fe558e 100644 --- a/source4/lib/replace/replace.c +++ b/source4/lib/replace/replace.c @@ -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. |