This is the mail archive of the
mailing list for the GCC project.
Re: fixincl problem
- To: Mark Kettenis <kettenis at wins dot uva dot nl>
- Subject: Re: fixincl problem
- From: Fergus Henderson <fjh at cs dot mu dot oz dot au>
- Date: Mon, 22 Jan 2001 12:57:35 +1100
- Cc: bkorb at gnu dot org, gcc at gcc dot gnu dot org
- References: <200101211828.f0LISlG00251@delius.kettenis.local>
On 21-Jan-2001, Mark Kettenis <email@example.com> wrote:
> The fixincl program does the equivalent of (in main()):
> /* In load_file_data(). */
> fclose (stdin);
> freopen ("/dev/null", "r", stdin);
> Which results in a segmentation fault on the Hurd.
> It looks as if this code isn't strictly portable. The current POSIX
> draft says in its description of fclose(FILE *stream):
> After the call to fclose() any use of STREAM results in undefined
The current ISO C standard implies the same:
| The value of a pointer to a FILE object is
| indeterminate after the associated file is closed (including
| the standard text streams).
Fergus Henderson <firstname.lastname@example.org> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.