On Fri, May 15, 2026 at 12:56:21PM +0200, Jan Stary wrote:
> Hi,
> 
> perhaps this is known, but it struck me as odd:
> when the string given to strtonum() correspomnds
> is a valid numeric string, but the value is too small,
> the error msg pointed to by strtonum will be "too small",
> but the message corresponding to errno = ERANGE will be
> "Result too large" (because that's ERANGE). Example below.
> 
> There is hardly any better errno to be set of course,
> but calling err() after a failed strtonum() might print
> a message that is a bit confusing.
> 

Look at the example in strtonum(3). It uses errx for a reason.
The errstr argument is enough to build a good error.

-- 
:wq Claudio

Reply via email to