Index: configure.in =================================================================== RCS file: /data/cvs/samba/source/configure.in,v retrieving revision 1.525 diff -u -r1.525 configure.in --- configure.in 19 Feb 2004 21:56:49 -0000 1.525 +++ configure.in 20 Feb 2004 23:39:00 -0000 @@ -2227,6 +2227,31 @@ AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES,1,[Whether the nisplus include files are broken]) fi +################################################# +# If you can believe it some versions of AIX have a broken strnlen. +# Actually it isn't a POSIX function so there is no official definition. + +if test x"$ac_cv_func_strnlen" = x"yes"; then + AC_CACHE_CHECK([for broken strnlen],samba_cv_HAVE_BROKEN_STRNLEN, [ + AC_TRY_RUN_STRICT([ +#include +#include +int main(void) +{ + char *s1 = "01234567891"; + int len = strnlen(s1,10); + + if (len == 10) + return 1; + return 0; +} + ],[],[$CPPFLAGS],[$LDFLAGS], + samba_cv_HAVE_BROKEN_STRNLEN=yes,samba_cv_HAVE_BROKEN_STRNLEN=no)]) + + if test x"$samba_cv_HAVE_BROKEN_STRNLEN" = x"yes"; then + AC_DEFINE(HAVE_BROKEN_STRNLEN,1,[Whether strnlen is broken]) + fi +fi ################################################# # check for smbwrapper support Index: lib/util_str.c =================================================================== RCS file: /data/cvs/samba/source/lib/util_str.c,v retrieving revision 1.109 diff -u -r1.109 util_str.c --- lib/util_str.c 13 Feb 2004 22:35:02 -0000 1.109 +++ lib/util_str.c 20 Feb 2004 23:39:03 -0000 @@ -1432,9 +1432,9 @@ } #endif -#ifndef HAVE_STRNLEN +#if !defined(HAVE_STRNLEN) || defined(HAVE_BROKEN_STRNLEN) /** - Some platforms don't have strnlen + Some platforms don't have strnlen or it's broken **/ size_t strnlen(const char *s, size_t n)