View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001809 | Issue 8 drafts | System Interfaces | public | 2024-02-10 17:34 | 2024-04-11 16:26 |
Reporter | alanc | Assigned To | |||
Priority | normal | Severity | Editorial | Type | Clarification Requested |
Status | Resolved | Resolution | Accepted As Marked | ||
Product Version | Draft 4 | ||||
Name | Alan Coopersmith | ||||
Organization | Oracle Solaris Engineering | ||||
User Reference | |||||
Section | close() | ||||
Page Number | 747 | ||||
Line Number | 25797-25799 | ||||
Final Accepted Text | 0001809:0006748 | ||||
Summary | 0001809: close() guidance to use fclose() should also discuss fdopen() | ||||
Description | In the Application Usage section for close(), it currently states: An application that had used the stdio routine fopen() to open a file should use the corresponding fclose() routine rather than close(). Once a file is closed, the file descriptor no longer exists, since the integer corresponding to it no longer refers to a file. Nothing I see currently gives similar guidance for what to do after using fdopen() so that users know that once they've called fdopen() on an fd they must now use fclose() and not just close() the underlying fd out from under stdio. | ||||
Desired Action | Change the first sentence to something like: An application that had used the stdio routine fopen() to open a file, or that had used fdopen() to create a stdio stream for an existing file descriptor, should use the corresponding fclose() routine rather than close(). And possibly add similar text to the fdopen() Application Usage section. | ||||
Tags | tc1-2024 |
related to | 0001810 | Resolved | fdopen() can only be used once per file descriptor |
|
Apologies, I selected the wrong version when filing, this should have been filed against Issue 8, Draft 4. |
|
This issue has been moved as requested by 0001809:0006649. |
|
Change:An application that had used the stdio routine fopen() to open a file should use the corresponding fclose() routine rather than close(). Once a file is closed, the file descriptor no longer exists, since the integer corresponding to it no longer refers to a file. to: If the file descriptor is associated with a standard I/O stream (for example, if the file descriptor was obtained by calling fileno() on a stream, or if an associated stream was created using fdopen()), the file descriptor should be closed using fclose() on the associated stream (or pclose() if the stream was opened using popen()) instead of calling close() or posix_close() on the file descriptor. Once a file descriptor is closed, the integer corresponding to it no longer refers to a file. However, the same integer can be allocated on a subsequent file open and would then become associated with the stream if the stream has not been closed. |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-02-10 17:34 | alanc | New Issue | |
2024-02-10 17:34 | alanc | Name | => Alan Coopersmith |
2024-02-10 17:34 | alanc | Organization | => Oracle Solaris Engineering |
2024-02-10 17:34 | alanc | Section | => close() |
2024-02-10 17:34 | alanc | Page Number | => 747 |
2024-02-10 17:34 | alanc | Line Number | => 25797-25799 |
2024-02-10 17:42 | alanc | Note Added: 0006649 | |
2024-02-10 18:53 | Don Cragun | Project | 1003.1(2013)/Issue7+TC1 => Issue 8 drafts |
2024-02-10 18:54 | Don Cragun | Note Added: 0006650 | |
2024-02-10 18:54 | Don Cragun | Product Version | => Draft 4 |
2024-02-10 18:57 | Don Cragun | Relationship added | related to 0001810 |
2024-04-11 16:25 | geoffclare | Note Added: 0006748 | |
2024-04-11 16:26 | geoffclare | Final Accepted Text | => 0001809:0006748 |
2024-04-11 16:26 | geoffclare | Status | New => Resolved |
2024-04-11 16:26 | geoffclare | Resolution | Open => Accepted As Marked |
2024-04-11 16:27 | geoffclare | Tag Attached: tc1-2024 |