[PATCH] BROKEN_STRNDUP and BROKEN_STRNLEN and AIX

Andrew Bartlett abartlet at samba.org
Wed May 22 01:39:33 MDT 2013


Simo and Christian,

I'm wondering if either of you know more about the allegation that
strndup and strnlen are broken on AIX?

This is one of the very few outstanding config.h differences I'm tracking in https://bugzilla.samba.org/show_bug.cgi?id=8969

It appears to be forced on for all AIX hosts:

commit 804cfb20a067b4b687089dc72a8271b3abf20f31
Author: Simo Sorce <idra at samba.org>
Date:   Wed Aug 25 14:24:16 2004 +0000

    r2070: Let's try to overload srnlen and strndup for AIX where they are natly broken.
    (This used to be commit 98feb3318f54bb48ce56fc8f4721fec4967b9dd9)

diff --git a/source3/configure.in b/source3/configure.in
index d35e89c..4329665 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1206,6 +1206,8 @@ if test "$enable_shared" = "yes"; then
                        fi
 
                        AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
+                       AC_DEFINE(BROKEN_STRNLEN,1,[Does strnlen work correctly])
+                       AC_DEFINE(BROKEN_STRNDUP,1,[Does strndup work correctly])
                        ;;
                *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
                        SHLIBEXT="sl"

Before I simply do the same in waf (probably in libreplace), do either
of you know more of the background here, such as does this apply to all
AIX versions, or is it possible to test for it less bluntly?

Otherwise, the attached (untested) patch should do that it.

Thanks,

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lib-replace-Set-BROKEN_STRNLEN-and-BROKEN_STRNDUP-on.patch
Type: text/x-patch
Size: 1389 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20130522/d7a66b50/attachment.bin>


More information about the samba-technical mailing list