public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincent+libc at vinc17 dot org" <sourceware-bugzilla@sources.redhat.com>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/682] New: stdout and file descriptor mismatch after a freopen()
Date: Wed, 19 Jan 2005 16:18:00 -0000	[thread overview]
Message-ID: <20050119161710.682.vincent+libc@vinc17.org> (raw)

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.


             reply	other threads:[~2005-01-19 16:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-19 16:18 vincent+libc at vinc17 dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050119161710.682.vincent+libc@vinc17.org \
    --to=sourceware-bugzilla@sources.redhat.com \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).