Closed smcpeak closed 2 years ago
Thanks for the quick response!
But there's a problem with this change. The way the code currently works, the E(0, ...)
entry applies to both the case of err_no
being zero and the case of it being unrecognized. Here's the full paragraph from POSIX:
If the value of errnum is a valid error number, the message string shall indicate what error occurred; if the value of errnum is zero, the message string shall either be an empty string or indicate that no error occurred; otherwise, if these functions complete successfully, the message string shall indicate that an unknown error occurred.
Note the final clause, requiring that upon an invalid and non-zero error number, "the message string shall indicate that an unknown error occurred." That part is now violated.
Addressed in latest PR.
Currently,
strerror(0)
returns"No error information"
.However, POSIX says:
Now, I haven't seen any explicit statement that this libc intends to comply with POSIX, and C11 7.23.6.2 does not contain this requirement, but it would seem like bringing
strerror
into POSIX compliance ought to be easy, and doing so would be beneficial to those with POSIX expectations.