Anonymous | Login | 2023-12-02 08:03 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 | ||
0000467 | [1003.1(2008)/Issue 7] System Interfaces | Objection | Enhancement Request | 2011-06-29 18:27 | 2019-06-10 08:55 | ||
Reporter | eblake | View Status | public | ||||
Assigned To | ajosey | ||||||
Priority | normal | Resolution | Accepted | ||||
Status | Closed | ||||||
Name | Eric Blake | ||||||
Organization | Red Hat | ||||||
User Reference | ebb.pipe | ||||||
Section | pipe | ||||||
Page Number | 1400 | ||||||
Line Number | 45851 | ||||||
Interp Status | --- | ||||||
Final Accepted Text | |||||||
Summary | 0000467: pipe should not modify fd on failure | ||||||
Description |
The standard is currently silent on the contents of filedes[0] and filedes[1] if pipe( ) fails, however, in the implementations that I surveyed, these values were unchanged. Adding a requirement to enforce this behavior can simplify some coding styles. Currently, I have to use: int fd[2] = { -1, -1 }; ... //do some work, which might goto error if (pipe(fd) < 0) { fd[0] = fd[1] = -1; goto error; } //do some more work, which might goto error ... error: if (fd[0] != -1) close(fd[0]); if (fd[1] != -1) close(fd[1]); //more cleanup; But if we guarantee that filedes is unchanged on error, then the implementation can rely on the previous contents, and skip the (re-)assignment of the fd contents to -1 on error, using: if (pipe(fd) < 0) goto error; |
||||||
Desired Action |
At line 45851 [XSH pipe RETURN VALUE], change: otherwise, −1 shall be returned and errno set to indicate the error. to: otherwise, −1 shall be returned, the contents of filedes left unmodified, and errno set to indicate the error. |
||||||
Tags | tc2-2008 | ||||||
Attached Files | |||||||
|
![]() |
||||||||||||||||
|
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |