Hi, It is also a quality of implementation issue. I have no objections to am implementation documenting that a second call to fclose shall result in indeterminate behaviour, and then not catching that the structure is no longer an active FILE * stream.
I do have a problem with the implementation not documenting the action, if it is not a benign ignoring of the second call (which may or may not have unpredictable results), issuing a diagnostic and terminating either at translation or execution stage. In other words, if the implementation is going to do anything strange, it has to document the behaviour. Anything else, In my interpretation, is a violation of the standar, or, at least, a very poor imlemntation. I am certainly going to complain to my vendor if it corrupts memory or makes monkies fly out of peoples noses (the SPCA would have something to say about that too). So, the point is not whether they implemntation can do strange and unexpected things; they can; but then they have to document it. BTW, in Debian, fclose says it returns an error, and does not mention corrupting memory. ERRORS EBADF The argument stream is not an open stream. The fclose function may also fail and set errno for any of the errors specified for the routines close(2) or fflush(3). close(2) says: RETURN VALUE close returns zero on success, or -1 if an error occurred. ERRORS EBADF fd isn't a valid open file descriptor. So if any memory was corrupted, report it as a bug (with possibly a non-normal severity) against libc6. A segfault is definitely not acceptable in the light of a documented rteturn value. Undefined does not mean that the implemntation has the right to mess up my machine (again, a quality of implementation issue even if in your judgement it does not violate the standard. I think an undocumented segfault is a violation of the standard). manoj -- "To be good, according to the vulgar standard of goodness, is obviously quite easy. It merely requires a certain amount of sordid terror, a certain lack of imaginative thought, and a certain low passion for middle-class respectability." Oscar Wilde Manoj Srivastava <[EMAIL PROTECTED]> <http://www.datasync.com/%7Esrivasta/> Key C7261095 fingerprint = CB D9 F4 12 68 07 E4 05 CC 2D 27 12 1D F5 E8 6E -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]