The following issue has been SUBMITTED. ====================================================================== https://austingroupbugs.net/view.php?id=1809 ====================================================================== Reported By: alanc Assigned To: ====================================================================== Project: 1003.1(2013)/Issue7+TC1 Issue ID: 1809 Category: System Interfaces Type: Clarification Requested Severity: Editorial Priority: normal Status: New Name: Alan Coopersmith Organization: Oracle Solaris Engineering User Reference: Section: close() Page Number: 747 Line Number: 25797-25799 Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2024-02-10 17:34 UTC Last Modified: 2024-02-10 17:34 UTC ====================================================================== Summary: 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. ====================================================================== Issue History 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 ======================================================================