svn commit: r367701 - head/lib/libutil

Scott Long scottl at samsco.org
Sun Nov 15 20:13:23 UTC 2020


> On Nov 15, 2020, at 1:05 PM, Warner Losh <imp at bsdimp.com> wrote:
> 
> Hey Scott,
> 
> On Sun, Nov 15, 2020 at 11:46 AM Scott Long <scottl at 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’ve looked at the implementation
> of strlcpy(), I see that you’re correct.  The man pages are definitely
> confusing, and this isn’t the only place where I think there’s
> 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.
> 

The wording on whether or not strlcpy and strlcat will provide NULL termination is also inconsistent, hence my comments about it last weekend.  I’m 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




More information about the svn-src-all mailing list