James Peach jpeach at
Tue Oct 17 02:56:38 GMT 2006

Hi all,

I've run into an interesting little conflict between libreplace and

Let's take a system that doesn't have a suitable strndup implementation.
libreplace figures this out and gives you a replacement function,
rep_strndup(), and a #define to rename strndup to rep_strndup. Now, when
you enable PARANOID_MALLOC_CHECKER, smb_xstrndup goes ahead and #undef's
and then calls strndup. At this point, if you don't have a real symbol
called strndup in libc, you'll fail to link.

Now, obviously this case is fixable, but IMO the #ifdef'ery performed by
libreplace is fragile and likely to keep stumbling over similar
breakage. Is there any reason why I can't have libreplace provide a real
symbol named strndup(), without the #define or any other funny business?

James Peach | jpeach at

More information about the samba-technical mailing list