lkml.org 
[lkml]   [2000]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Closing the FILE object.
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/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.177 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site