libc: strtoul() forgets to set errno to EINVAL when no conversion could be performed
The strtoul() function may fail if: EINVAL No conversion could be performed.
This is missing from the implementation of
strtoul(), [see here: /usr/src/common/util/strtoul.c, line 98], and just returns with zero.
Updated by Garrett D'Amore over 4 years ago
So the EINVAL return value was added in XPG6 -- for older versions it wasn't specified. This is probably why it is called out that way.
Arguably we could probably just go ahead and do it unconditionally, software should be able to cope with this. But if we wanted to be thorough, we would only return EINVAL in that case if the code was built for XPG6 or XPG7.
Frankly, I'd like to get rid of the pre-XPG4 stuff, and maybe even just start doing XPG6 everywhere now. But that's a bigger discussion.