A NOTE has been added to this issue. ====================================================================== https://austingroupbugs.net/view.php?id=1810 ====================================================================== Reported By: alanc Assigned To: ====================================================================== Project: Issue 8 drafts Issue ID: 1810 Category: System Interfaces Type: Clarification Requested Severity: Editorial Priority: normal Status: New Name: Alan Coopersmith Organization: Oracle Solaris Engineering User Reference: Section: fdopen() Page Number: 917 Line Number: 31300-31397 Final Accepted Text: ====================================================================== Date Submitted: 2024-02-10 17:41 UTC Last Modified: 2024-04-11 11:02 UTC ====================================================================== Summary: fdopen() can only be used once per file descriptor ====================================================================== Relationships ID Summary ---------------------------------------------------------------------- related to 0001809 close() guidance to use fclose() should... ======================================================================
---------------------------------------------------------------------- (0006744) geoffclare (manager) - 2024-04-11 11:02 https://austingroupbugs.net/view.php?id=1810#c6744 ---------------------------------------------------------------------- Adding some sort of warning about the fclose() issue raised in the bug description is fine. However, I think https://austingroupbugs.net/view.php?id=1810#c6652 goes too far. As long as the rules in XSH 2.5.1 "Interaction of File Descriptors and Standard I/O Streams" are followed, and the fclose() issue is taken into account, it is possible for an application to have two streams with the same underlying file descriptor and suffer no ill effects. (I can't think of a reason why an application would want to do this, but the standard should not warn against it just because its developers lack imagination.) For similar reasons, I think any warning about the fclose() issue should not advise against having two streams with the same underlying file descriptor, but rather advise about the need to take care when closing them. (In particular, the application needs to ensure that no operations that open a file descriptor are performed in between the two fclose() calls, otherwise the second could close the newly opened fd instead of getting an EBADF error.) Issue History Date Modified Username Field Change ====================================================================== 2024-02-10 17:41 alanc New Issue 2024-02-10 17:41 alanc Name => Alan Coopersmith 2024-02-10 17:41 alanc Organization => Oracle Solaris Engineering 2024-02-10 17:41 alanc Section => fdopen() 2024-02-10 17:41 alanc Page Number => 917 2024-02-10 17:41 alanc Line Number => 31300-31397 2024-02-10 18:57 Don Cragun Relationship added related to 0001809 2024-02-12 19:09 alanc Note Added: 0006652 2024-04-11 11:02 geoffclare Note Added: 0006744 ======================================================================