From 515067a02eb03242411c8af4642265784af8d177 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 3 Sep 2006 16:33:12 +0000 Subject: r18018: Fix the build on OpenBSD. No license problem this time, I've written strnlen from scratch. Volker (This used to be commit 2a7cdf52e4113db30a7a8b180c68cec736f6c186) --- source4/lib/replace/replace.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'source4/lib/replace/replace.c') 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. -- cgit