Anonymous | Login | 2023-12-07 11:24 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||
ID | Category | Severity | Type | Date Submitted | Last Update | ||
0000384 | [1003.1(2008)/Issue 7] Base Definitions and Headers | Objection | Omission | 2011-02-22 18:52 | 2016-07-28 15:10 | ||
Reporter | eblake | View Status | public | ||||
Assigned To | ajosey | ||||||
Priority | normal | Resolution | Rejected | ||||
Status | Closed | ||||||
Name | Eric Blake | ||||||
Organization | Red Hat | ||||||
User Reference | ebb.va_end | ||||||
Section | stdarg.h | ||||||
Page Number | 339 | ||||||
Line Number | 11403 | ||||||
Interp Status | --- | ||||||
Final Accepted Text | |||||||
Summary | 0000384: the stdarg macros should not modify errno | ||||||
Description |
Line 25639 [XSH errno] is explicit that "The setting of errno after a successful call to a function is unspecified unless the description of that function specifies that errno shall not be modified." However, none of the stdarg macros (va_start, va_copy, va_arg, va_end) mention their interaction with errno, which renders common code like this undefined, all because the successful va_end() invocation occurs between the point of the failure and the actual error reporting: // error-checking variant of snprintf int xsnprintf(char *str, size_t size, const char *fmt, ...) { va_list ap; int ret; va_start(ap, fmt); ret = vsprintf(str, size, fmt, ap); va_end(ap); if (ret < 0) { perror("vsprintf failed"); exit(EXIT_FAILURE); } return ret; } Typically, all va_* macros have no effect on errno, so we might as well require that, which would make the above example conforming. |
||||||
Desired Action |
After line 11403 [XCU <stdarg.h> DESCRIPTION], add a sentence with CX shading: The four macros defined in this header shall not change the value of errno. |
||||||
Tags | No tags attached. | ||||||
Attached Files | |||||||
|
![]() |
||||||||||||||||||||||||||
|
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |