Re: Closing the FILE object.

From: Andries Brouwer (aeb@veritas.com)
Date: Sat Jul 15 2000 - 07:09:36 EST


On Fri, Jul 14, 2000 at 01:25:06PM -0400, Richard B. Johnson wrote:

> This is in reference to the reported seg-faults when attempting to
> fclose() an invalid file pointer.
>
> The following shows that my current 'C' runtime library does not
> adhere to any known standard when referencing the FILE object during
> fclose(). This is gcc 2.7.2.3 (libc 5.3.12)

No, it does not show that.
It shows that you misinterpreted the wording of the man page.
I adapted the wording a bit to make things clearer, if possible.

       EBADF The filedescriptor underlying stream is not valid.

In your case the stream itself is not a stream at all,
and random things may happen. You can get the EBADF error
by doing close(fileno(fp)) first.

Andries

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jul 15 2000 - 21:00:21 EST