From d3c55f028e4160506538c9e1c57d3a6e22701a3c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 26 Aug 2006 16:19:22 +0000 Subject: r17840: A step towards building on Solaris which appears not to have strnlen. Volker (This used to be commit ebf75c6196afdd4bfa4f11bb1d45d385ab0babed) --- source4/lib/replace/config.m4 | 2 +- source4/lib/replace/replace.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/config.m4 b/source4/lib/replace/config.m4 index 93f0bb34a7..adaba74568 100644 --- a/source4/lib/replace/config.m4 +++ b/source4/lib/replace/config.m4 @@ -50,7 +50,7 @@ AC_CHECK_HEADERS(sys/syslog.h syslog.h) AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror) AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename) AC_CHECK_FUNCS(waitpid strlcpy strlcat innetgr initgroups memmove strdup) -AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp) +AC_CHECK_FUNCS(pread pwrite strndup strnlen strcasestr strtok_r mkdtemp) AC_HAVE_DECL(setresuid, [#include ]) AC_HAVE_DECL(setresgid, [#include ]) AC_HAVE_DECL(errno, [#include ]) diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c index b8f4bc1c3c..1cf91751b3 100644 --- a/source4/lib/replace/replace.c +++ b/source4/lib/replace/replace.c @@ -387,6 +387,20 @@ duplicate a string } #endif +#ifndef HAVE_STRNLEN +/** + Some platforms don't have strnlen +**/ + + size_t strnlen(const char *s, size_t n) +{ + size_t i; + for (i=0; i