Bug 3137 - FILE *stdin, *stdout, *stderr are not constant in stdio.h
FILE *stdin, *stdout, *stderr are not constant in stdio.h
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
6.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Cristian Gafton
:
: 3253 3742 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-05-28 23:49 EDT by Damien, Miller
Modified: 2008-05-01 11:37 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-05-29 09:59:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Damien, Miller 1999-05-28 23:49:58 EDT
FILE *stdin, *stdout, *stderr are no longer declared
constant in stdio.h. They have been constant in previous
versions of RHL (as well as just about every other OS on the
planet).

This breaks all sorts of code. A trivial example:

---------------

#include <stdio.h>

FILE *logf = stderr;

int main(void)
{
	fprintf(logf, "This bites.\n");
}

---------------
Comment 1 Jeff Johnson 1999-05-29 09:59:59 EDT
Yes, glibc-2.1 requires programs to be re-written as below. Some
of the internals of the stdio structures have changed making
compatibility with glibc-2.0 more problematic than it would be
otherwise. The change below permits the loader to fix certain of
these problems and prevents the situation from happening again.
(At least I think that's the correct explanation ...)

#include <stdio.h>

FILE *logf;

int main(void)
{
	logf = stderr;
        fprintf(logf, "This bites.\n");
}
Comment 2 Jeff Johnson 1999-06-03 16:34:59 EDT
*** Bug 3253 has been marked as a duplicate of this bug. ***

In glibc-devel-2.1.1-6 a gratuitous change to
stdio.h/libio.h was made which prevents stdin, stderr and
stdout from being used as initializers.

The code below complies on every system I've tried *except*
the latest glibc-devel-2.1.1.

#include <stdio.h>
FILE *x = stdout;

An (unnacceptable) workaround is to use
_IO_stdout.
Comment 3 Jeff Johnson 1999-06-26 09:53:59 EDT
*** Bug 3742 has been marked as a duplicate of this bug. ***

The change of stderr in the standard include file
/usr/include/stdio.h from #define stderr _IO_stderr in
Redhat 5.2 to:

extern FILE *stderr

in Rh 6.0 may cause problems in older programs that expect
the normal definition for stderr.

Note You need to log in before you can comment on or make changes to this bug.