Bug 3137

Summary: FILE *stdin, *stdout, *stderr are not constant in stdio.h
Product: [Retired] Red Hat Linux Reporter: Damien, Miller <dmiller>
Component: glibcAssignee: Cristian Gafton <gafton>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: brownt, rshapiro
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-05-29 13:59:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Damien, Miller 1999-05-29 03:49:58 UTC
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 13:59:59 UTC
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 20:34:59 UTC
*** 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 13:53:59 UTC
*** 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.