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] stdout and file descriptor mismatch after a freopen()
Date: Mon, 14 Feb 2005 17:30:00 -0000	[thread overview]
Message-ID: <20050214173044.26661.qmail@sourceware.org> (raw)
In-Reply-To: <20050119161710.682.vincent+libc@vinc17.org>


------- Additional Comments From vincent+libc at vinc17 dot org  2005-02-14 17:30 -------
I propose the following idea:
  * open() always returns fd > 2 (or -1 if an error occurred). [*]
  * If fp is stdin, stdout or stderr, then freopen() uses open() + dup2().
i.e. the only way to get a fd <= 2 (corresponding to a standard stream) is to
force this with dup2().

[*] This would require a kernel fix, I suppose. Otherwise, just make sure that
fd > 2 if fopen() is used (for instance, by reassigning the fd with dup2()).
This wouldn't eliminate the race condition though, but pure C programs would
work as expected.

-- 


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.


  parent reply	other threads:[~2005-02-14 17:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-19 16:18 [Bug libc/682] New: " 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 [this message]
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

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=20050214173044.26661.qmail@sourceware.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).