"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
"Todd C. Miller" <millert@openbsd.org>
Subject:
Re: *printf return value
To:
Theo Buehler <tb@theobuehler.org>
Cc:
Omar Polo <op@omarpolo.com>, gameoftrees@openbsd.org
Date:
Wed, 10 Aug 2022 07:17:58 -0600

Download raw body.

Thread
On Wed, 10 Aug 2022 14:54:16 +0200, Theo Buehler wrote:

> I'd rather you changed those into ret < 0 to match what the CAVEAT in
> the snprintf(3) manual says - it used to say ret == -1 but that was
> changed a few years back because standards decided to allow negative
> returns instead of only -1.

Agreed.  Another option is to store the return value in an unsigned
int or size_t so you only need to do the >= check.  But that is
probably more confusing and would lead to someone later on trying
to "fix" it.

 - todd