[PATCH] Implement strlcat [BZ#178]

Paul Eggert eggert@cs.ucla.edu
Thu Dec 3 22:42:00 GMT 2015


On 12/03/2015 10:08 AM, Zack Weinberg wrote:
> char *my_strdup(char *s)

Sorry, I should have been clearer. I'd like to see real-world 
applications that care about these weird corner cases. I'm skeptical 
that such applications exist. I'm sure that one can find contrived 
examples and feature-test programs and suchlike, but production code?

> I would actively expect strlcpy (0, SRC, 0) to be used

Any such usage would not work under NetBSD's current strlcpy 
implementation, which does not allow the destination to be a null 
pointer. So strlcpy (0, SRC, 0) is already not portable, and we don't 
need to support it.

> If we're going to have these functions at all, they need to work 
> _exactly_ as they do on *BSD

There is no "_exactly_". The BSDs differ.

As you know, I'd rather we didn't support these poorly-designed APIs; 
but if we do support them at least we can help out a bit by catching any 
apps that fall into these API's weirder cracks.



More information about the Libc-alpha mailing list