Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Nov 2020 13:13:18 -0700
From:      Scott Long <scottl@samsco.org>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Jessica Clarke <jrtc27@freebsd.org>, Scott Long <scottl@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org>, Stefan Esser <se@freebsd.org>
Subject:   Re: svn commit: r367701 - head/lib/libutil
Message-ID:  <9578C457-F9C9-4B27-ACCE-1B66256B06A9@samsco.org>
In-Reply-To: <CANCZdfqjpVo2q=dzKU3ox=Oaeo=s8vOSF%2BWtaK5HhYpeyrBM5Q@mail.gmail.com>
References:  <202011150748.0AF7mqW3016900@repo.freebsd.org> <D5492BB4-A282-4E35-B02F-1216769FDA51@freebsd.org> <A39C12CC-D3D6-4166-9089-7466FA1C2B2D@samsco.org> <CANCZdfqjpVo2q=dzKU3ox=Oaeo=s8vOSF%2BWtaK5HhYpeyrBM5Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

> On Nov 15, 2020, at 1:05 PM, Warner Losh <imp@bsdimp.com> wrote:
>=20
> Hey Scott,
>=20
> On Sun, Nov 15, 2020 at 11:46 AM Scott Long <scottl@samsco.org> wrote:
> The man page for strlcpy() made reference to the return value being
> equivalent to what snprintf() does.  The man page for snprintf() =
states
> that negatve return values are possible, so I assumed the same was
> true for strlcpy().  However, now that I=E2=80=99ve looked at the =
implementation
> of strlcpy(), I see that you=E2=80=99re correct.  The man pages are =
definitely
> confusing, and this isn=E2=80=99t the only place where I think =
there=E2=80=99s
> inconsistency in the documentation, or at least poor wording choices.
>=20
> Yea, it says both that it will never return a negative value (since =
size_t is never negative) and that it returns the same things as =
snprintf (which is true... except for that detail which it glosses over =
in return type differences).
>=20
> So this issue doesn't get lost, I've added a clarification to the =
examples in  https://reviews.freebsd.org/D27228 . Please take a look and =
let me know what you think. If more extensive edits are needed, there's =
full context so you can at least flag those in the review as well. I've =
read these too many times to see the other places you're talking about, =
so a fresh set of eyes would be helpful.
>=20

The wording on whether or not strlcpy and strlcat will provide NULL =
termination is also inconsistent, hence my comments about it last =
weekend.  I=E2=80=99m going to revert all of this back to and including =
r367075, since Stefan wants to do this a totally different way.  Sorry =
for the noise everyone and thanks for the help, I learned a lot through =
this process.

Scott





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9578C457-F9C9-4B27-ACCE-1B66256B06A9>