[PATCH] Implement strlcat [BZ#178]

Paul Eggert eggert@cs.ucla.edu
Thu Nov 26 10:34:00 GMT 2015


Florian Weimer wrote:
> I'm attaching the consolidated documentation patch.

Thanks.  Attached are three patches fixing the problems I mentioned earlier, 
relative to the current glibc master.  The first two patches are independent of 
strlcpy+strlcat: they switch to less-confusing terminology (e.g., "byte" instead 
of "character" when talking about strcpy), and split the enormous "Copying 
Strings and Arrays" section into more-manageable subsections while adding advice 
about string truncation.  The third patch adds strlcpy/strlcat and relies on the 
earlier two patches.

I still would rather not add strlcpy+strlcat, but if we're going to add them 
they will need decent documentation, and I hope this is good enough.

PS.  This time around I noticed that in some cases strlcat is required to not 
null-terminate its output, even when there's room for a null byte in the 
destination buffer.  Eeeuuuw.  Do we really want to document that particular 
misfeature?  Does user code really require it?  Perhaps it'd be better to leave 
the behavior undefined in that particular case, i.e., to require that strlcat's 
first argument be a string if SIZE is nonzero.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Consistency-about-byte-vs-character-in-string.texi.patch
Type: text/x-diff
Size: 55085 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20151126/76dde80d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Split-large-string-section-add-truncation-advice.patch
Type: text/x-diff
Size: 28569 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20151126/76dde80d/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Add-strlcpy-strlcat.patch
Type: text/x-diff
Size: 6192 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20151126/76dde80d/attachment-0002.bin>


More information about the Libc-alpha mailing list