This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/13983] __libc_message() shouldn't blindly write to STDERR_FILENO
- From: "nenolod at dereferenced dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Mon, 16 Apr 2012 08:33:46 +0000
- Subject: [Bug libc/13983] __libc_message() shouldn't blindly write to STDERR_FILENO
- Auto-submitted: auto-generated
- References: <bug-13983-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=13983
--- Comment #9 from William Pitcock <nenolod at dereferenced dot org> 2012-04-16 08:33:46 UTC ---
(In reply to comment #8)
> I'm not sure anymore whether this is worth fixing.
>
> (In reply to comment #7)
> > This is fine too, but glibc should make sure stderr really is stderr.
>
> Ok, but how should we do that?
At libio/iofclose.c:85, there is:
if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr)
{
fp->_IO_file_flags = 0;
free(fp);
}
This means we can always use fwrite on _IO_stdin, _IO_stdout, _IO_stderr, as
they will always stay around. So, we can just use fwrite() with static
buffers, as they will have fp->_fileno = -1, which will silently fail. Or we
can just use _IO_stderr->_fileno instead of STDERR_FILENO define.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.