This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] Implement strlcpy [BZ #178]
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Florian Weimer <fweimer at redhat dot com>, "libc-al >> GNU C Library" <libc-alpha at sourceware dot org>
- Date: Mon, 15 Sep 2014 09:45:07 -0700
- Subject: Re: [PATCH] Implement strlcpy [BZ #178]
- Authentication-results: sourceware.org; auth=none
- References: <5416EDEA dot 4080903 at redhat dot com> <54170B62 dot 90900 at cs dot ucla dot edu> <54171592 dot 3040609 at redhat dot com>
On 09/15/2014 09:36 AM, Florian Weimer wrote:
How is it incompatible with the OpenBSD implementation?
As Rich Felker mentioned, OpenBSD strlcpy always returns the length of
the source, regardless of what was stored.
The original documentation for strncpy already called it ârarely
usefulâ, otherwise I wouldn't have used this phrasing.
strlcpy is rarely useful as well. I agree with Rich that if we document
strlcpy, we should say that it's not recommended for new code. We
should also mention the above problem, which unfortunately is an
all-too-common misunderstanding of how strlcpy works.
But really, it'd be better to keep leaving it out. It's just a mess.