Re: fclose() again

From: Jan-Simon Pendry (JS.Pendry@msdw.com)
Date: Fri Jul 14 2000 - 16:01:37 EST


The man page for fclose says:

       Upon successful completion 0 is returned. Otherwise, EOF
       is returned and the global variable errno is set to indi<AD>
       cate the error. In either case any further access
       (including another call to fclose()) to the stream results
       in undefined behaviour.

the suspicion is that fclose has already been called on the
stream, and so the second call to fclose results in the "undefined
behaviour" described above. this can include a SEGV.

jan-simon.

Evan Langlois wrote:
>
> Well, according to the man page, fclose() should return EBADF if the passed
> argument is not an open stream. No where does it say that it segfaults, and
> the I don't see when it returns EBADF instead of segfaulting.
>
> I think the library might need to be patched, wherever it is segfaulting.
>
> ***** quote ************
> ** fclose requires a valid FILE object pointer, and NULL isn't among them.
> ** Case closed.
> **
> ** Andreas.

-
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:20 EST