From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <6fd5df0f5ab6393dc277a80e8d3efc36.axp-list@archive.invalid> X-Archive-Original-Message-ID: <199702242005.VAA08382@jupiter.stochastik.rwth-aachen.de> Date: 24 Feb 1997 19:41:54 -0000 From: Eric Smith Subject: Re: fclose() Uncle George wrote: > I just looked at the Linux man pages for fclose(). I shudda looked at > them at the beginning of this dialog, but interestingly enough THAT > DOCUMENTATION seems to support my view point -under ERRORS: > EBADF the argument stream is not an open stream. Yes, but even if it did that, you *still* wouldn't be safe calling fclose() twice on the same stream. Why? Because it would still be possible that an intermediate open() call might have returned the same pointer: f1 = fopen ("foo", "r"); /* returns 28 */ fclose (f1); f2 = fopen ("bar", "r"); /* also returns 28 */ fclose (f1); /* oops! 28 is still a valid stream! */ fprintf (f2, "test\n"); /* fails */ Cheers, Eric -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com