Author: vlendec Date: 2006-08-26 16:19:22 +0000 (Sat, 26 Aug 2006) New Revision: 17840
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17840 Log: A step towards building on Solaris which appears not to have strnlen. Volker Modified: branches/SAMBA_4_0/source/lib/replace/config.m4 branches/SAMBA_4_0/source/lib/replace/replace.c Changeset: Modified: branches/SAMBA_4_0/source/lib/replace/config.m4 =================================================================== --- branches/SAMBA_4_0/source/lib/replace/config.m4 2006-08-26 15:38:01 UTC (rev 17839) +++ branches/SAMBA_4_0/source/lib/replace/config.m4 2006-08-26 16:19:22 UTC (rev 17840) @@ -50,7 +50,7 @@ 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>]) Modified: branches/SAMBA_4_0/source/lib/replace/replace.c =================================================================== --- branches/SAMBA_4_0/source/lib/replace/replace.c 2006-08-26 15:38:01 UTC (rev 17839) +++ branches/SAMBA_4_0/source/lib/replace/replace.c 2006-08-26 16:19:22 UTC (rev 17840) @@ -387,6 +387,20 @@ } #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) {