This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/13983] __libc_message() shouldn't blindly write to STDERR_FILENO


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]