Author: tridge Date: 2006-09-28 06:43:27 +0000 (Thu, 28 Sep 2006) New Revision: 18970
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18970 Log: avoid strndup and strnlen on AIX. They are quite broken. See http://lists.samba.org/archive/samba-technical/2004-August/036915.html Modified: branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4 branches/SAMBA_4_0/source/lib/replace/replace.h Changeset: Modified: branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4 =================================================================== --- branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4 2006-09-28 03:21:49 UTC (rev 18969) +++ branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4 2006-09-28 06:43:27 UTC (rev 18970) @@ -66,6 +66,8 @@ fi ;; *aix*) + AC_DEFINE(BROKEN_STRNDUP, 1, [Whether strndup is broken]) + AC_DEFINE(BROKEN_STRNLEN, 1, [Whether strnlen is broken]) if test "${GCC}" != "yes"; then ## for funky AIX compiler using strncpy() CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000" Modified: branches/SAMBA_4_0/source/lib/replace/replace.h =================================================================== --- branches/SAMBA_4_0/source/lib/replace/replace.h 2006-09-28 03:21:49 UTC (rev 18969) +++ branches/SAMBA_4_0/source/lib/replace/replace.h 2006-09-28 06:43:27 UTC (rev 18970) @@ -121,12 +121,14 @@ size_t rep_strlcat(char *d, const char *s, size_t bufsize); #endif -#ifndef HAVE_STRNDUP +#if (defined(BROKEN_STRNDUP) || !defined(HAVE_STRNDUP)) +#undef HAVE_STRNDUP #define strndup rep_strndup char *rep_strndup(const char *s, size_t n); #endif -#ifndef HAVE_STRNLEN +#if (defined(BROKEN_STRNLEN) || !defined(HAVE_STRNLEN)) +#undef HAVE_STRNLEN #define strnlen rep_strnlen size_t rep_strnlen(const char *s, size_t n); #endif
