diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-08-26 16:19:22 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:16:47 -0500 |
commit | d3c55f028e4160506538c9e1c57d3a6e22701a3c (patch) | |
tree | c612078e048ce8bf65f25ae0d7f4e1839d4f7657 | |
parent | 25ba47eaf8a8c66ab131701e61a6ea8c2a0e49d8 (diff) | |
download | samba-d3c55f028e4160506538c9e1c57d3a6e22701a3c.tar.gz samba-d3c55f028e4160506538c9e1c57d3a6e22701a3c.tar.bz2 samba-d3c55f028e4160506538c9e1c57d3a6e22701a3c.zip |
r17840: A step towards building on Solaris which appears not to have strnlen.
Volker
(This used to be commit ebf75c6196afdd4bfa4f11bb1d45d385ab0babed)
-rw-r--r-- | source4/lib/replace/config.m4 | 2 | ||||
-rw-r--r-- | source4/lib/replace/replace.c | 14 |
2 files changed, 15 insertions, 1 deletions
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 <unistd.h>]) AC_HAVE_DECL(setresgid, [#include <unistd.h>]) AC_HAVE_DECL(errno, [#include <errno.h>]) 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<n && s[i] != '\0'; i++) + /* noop */ ; + return i; +} +#endif + #ifndef HAVE_WAITPID int waitpid(pid_t pid,int *status,int options) { |