public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/682] New: stdout and file descriptor mismatch after a freopen()
@ 2005-01-19 16:18 vincent+libc at vinc17 dot org
  2005-02-14 15:47 ` [Bug libc/682] " gotom at debian dot or dot jp
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: vincent+libc at vinc17 dot org @ 2005-01-19 16:18 UTC (permalink / raw)
  To: glibc-bugs

Closing stdin with fclose(stdin) and redirecting stdout with freopen(...,stdout)
make stdout associated with file descriptor 0 instead of 1, leading to
non-documented side effects (and even incompatible with documentation supplied
with Linux: the stdin(3) man page). After a discussion (in French) in
fr.comp.lang.c, several users agreed that this could be seen as a bug and should
be fixed. See bug 670 for a testcase.

Note: Of course, stdin and stderr are affected too, and so is the fopen() function.

A correct behavior would be to reserve file descriptors 0, 1 and 2 for stdin,
stdout and stderr at the fopen/fclose/freopen level (the functions defined by
the ISO C standard). If the programmer uses system calls directly, he should
make sure not to break this convention.

-- 
           Summary: stdout and file descriptor mismatch after a freopen()
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: vincent+libc at vinc17 dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sources.redhat.com/bugzilla/show_bug.cgi?id=682

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <bug-682-131@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2014-05-28 19:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-19 16:18 [Bug libc/682] New: stdout and file descriptor mismatch after a freopen() vincent+libc at vinc17 dot org
2005-02-14 15:47 ` [Bug libc/682] " gotom at debian dot or dot jp
2005-02-14 17:30 ` vincent+libc at vinc17 dot org
2005-02-14 17:36 ` jakub at redhat dot com
2005-02-15  0:13 ` vincent+libc at vinc17 dot org
2005-06-16 15:50 ` michael dot kerrisk at gmx dot net
2005-06-16 21:12 ` vincent+libc at vinc17 dot org
2009-10-29 17:58 ` vincent+libc at vinc17 dot org
     [not found] <bug-682-131@http.sourceware.org/bugzilla/>
2014-02-16 19:30 ` jackie.rosen at hushmail dot com
2014-05-28 19:43 ` schwab at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).