NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

PR/58461 CVS commit: src/common/lib/libc/stdlib



The following reply was made to PR lib/58461; it has been noted by GNATS.

From: "Robert Elz" <kre%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc: 
Subject: PR/58461 CVS commit: src/common/lib/libc/stdlib
Date: Wed, 24 Jul 2024 09:11:28 +0000

 Module Name:	src
 Committed By:	kre
 Date:		Wed Jul 24 09:11:28 UTC 2024
 
 Modified Files:
 	src/common/lib/libc/stdlib: _strtoi.h
 
 Log Message:
 PR lib/58461  PR lib/58453 portability fixes
 
 Revert previous (1.4) and make the changes properly.
 
 If base is invalid, what gets left in *endptr by strtoimax()
 is unspecified (it is not guaranteed to be either nptr or unaltered)
 and so cannot (in that case) be used in any way at all.
 
 Since it is hard to determine from some implementations of
 strtoimax() whether this happened or not, simply duplicate
 the validity test for base here, so we know that error (EINVAL
 because base is invalid) cannot occur from strtoimax().   In that
 case, if we get an EINVAL from strtoimax we can simply ignore it,
 as all it can mean is the (optional in POSIX) case where no
 conversion occurred (where strtoi() sets the status to ECANCELED).
 
 Since NetBSD never did that, this all changes nothing here, but
 makes strtoi() portable to other environments using a different
 version of strtoimax().
 
 NFCI.
 
 No pullups required, nothing has really changed, there never was
 a NetBSD bug to fix.
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/stdlib/_strtoi.h
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 


Home | Main Index | Thread Index | Old Index