Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Nov 2020 13:05:04 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Scott Long <scottl@samsco.org>
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>
Subject:   Re: svn commit: r367701 - head/lib/libutil
Message-ID:  <CANCZdfqjpVo2q=dzKU3ox=Oaeo=s8vOSF%2BWtaK5HhYpeyrBM5Q@mail.gmail.com>
In-Reply-To: <A39C12CC-D3D6-4166-9089-7466FA1C2B2D@samsco.org>
References:  <202011150748.0AF7mqW3016900@repo.freebsd.org> <D5492BB4-A282-4E35-B02F-1216769FDA51@freebsd.org> <A39C12CC-D3D6-4166-9089-7466FA1C2B2D@samsco.org>

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

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 impleme=
ntation
> of strlcpy(), I see that you=E2=80=99re correct.  The man pages are defin=
itely
> 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.


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).

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.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqjpVo2q=dzKU3ox=Oaeo=s8vOSF%2BWtaK5HhYpeyrBM5Q>