Re: Write to a closed stream bug.

Pavel Machek (pavel@Elf.mj.gts.cz)
Thu, 18 Dec 1997 13:09:20 +0100


Hi!

> > be performed. It is entirely unacceptable for any function, whether
> > it is in a runtime-library, or is coded by an application, to
> > pretend that it performed some function that, in fact, it did not.
>
> try strcpy(0x12543456, 0x247375394)
>
> shock horror it crashes. You passed it a bad pointer. You did the
> same

It is ok - strcpy either copies memory, or raises SIGSEGV. That's
ok. It reported error.

About scaling: Yes, it is true that checking for this condition would
require one mov somewhere inn fclose. Do you think that this is an
issue?

And: It behaved incorrectly: you gave it some invalid handle. It did
not *write* anywhere. If you passed invalid handle, that was valid
enough for data to go *somewhere*, returning success would be
acceptable.

Pavel

-- 
I'm really pavel@atrey.karlin.mff.cuni.cz. 	   Pavel
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).