The following issue has been SUBMITTED. 
====================================================================== 
https://austingroupbugs.net/view.php?id=1855 
====================================================================== 
Reported By:                jsm28
Assigned To:                
====================================================================== 
Project:                    1003.1(2024)/Issue8
Issue ID:                   1855
Category:                   System Interfaces
Type:                       Clarification Requested
Severity:                   Comment
Priority:                   normal
Status:                     New
Name:                       Joseph Myers 
Organization:                
User Reference:              
Section:                    freopen 
Page Number:                1030-1034 
Line Number:                35272-35445 
Interp Status:              --- 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2024-09-05 21:36 UTC
Last Modified:              2024-09-05 21:36 UTC
====================================================================== 
Summary:                    Use of freopen with different kinds of streams
Description: 
When is it valid to use freopen with a stream that did not originate from
fopen and is not one of stdin, stdout or stderr?

* Is it valid to use freopen on a stream originating with popen? I think
it's understood that streams opened with popen are to be closed with pclose
- but the popen normative text doesn't say that (only the APPLICATION USAGE
says they "should" be closed with pclose) and I don't see anything in
either the fclose or freopen normative text to disallow use of those
functions on such a stream either.

* What about streams originating with fmemopen or open_memstream? Can
freopen be used on those streams? And does that depend on whether the
pathname argument to freopen is a null pointer - does the EBADF error for
"The file descriptor underlying the stream is not a valid file descriptor
when pathname is a null pointer." require freopen with pathname == NULL to
fail for streams from fmemopen or open_memstream because there is no
underlying file descriptor for such streams?
Desired Action: 
Clarify what combinations of opening / reopening / closing functions are
valid on streams - both "valid" as in "does not result in undefined
behavior", and "valid" as in "required to work with specific semantics or
produce one of the specified errors if the relevant conditions are met".
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2024-09-05 21:36 jsm28          New Issue                                    
2024-09-05 21:36 jsm28          Name                      => Joseph Myers    
2024-09-05 21:36 jsm28          Section                   => freopen         
2024-09-05 21:36 jsm28          Page Number               => 1030-1034       
2024-09-05 21:36 jsm28          Line Number               => 35272-35445     
======================================================================


  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group

Reply via email to