View Issue Details

IDProjectCategoryView StatusLast Update
00020151003.1(2024)/Issue8System Interfacespublic2026-11-29 17:18
Reporterromanzilka Assigned To 
PrioritynormalSeverityCommentTypeClarification Requested
Status NewResolutionOpen 
NameRoman Žilka
Organization
User Reference
Sectionstrerror
Page Number0
Line Number0
Interp Status
Final Accepted Text
Summary0002015: strerror*(): Inconsistencies re. behavior on error
DescriptionThe section on strerror*() says:

"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."

It should be made clear that strerror() does return strings in said format, but isn't one of "these functions", because "strerror() shall map any value of type int to a message" and "whether successful or not, strerror() shall return a pointer to the generated message string". The sentence (quoted in full) is the only place in the whole Description which deals with the specific contents of the returned string, so it's tempting to try and fit strerror() into that (whole) sentence.

As for strerror_l(), "if these functions complete successfully, the message string shall indicate that an unknown error occurred", so when EINVAL is the outcome, it may not have returned a valid string. But later: "If errnum is not a valid error number, errno may be set to [EINVAL], but a pointer to a message string shall still be returned". It's hard to tell which of these two behaviors is intended.

Elsewhere: "strerror_l() is required to return a string for some errors" may again be wrong, see above.

strerror_r() seems clear: in the EINVAL situation, a non-zero may or may not be returned, but when it isn't, a string was returned.

In Rationale, this sentence provides no new information or advice: "Since no return value is reserved to indicate a strerror() error, but all calls (whether successful or not) must return a pointer to a message string, on error strerror() can return a pointer to an empty string or a pointer to a meaningful string that can be printed."
Desired ActionI can formulate a proposal after clarification.
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2026-11-29 17:18 romanzilka New Issue