lkml.org 
[lkml]   [1997]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Write to a closed stream bug.
Date
>   The glibc bug is that a write to a closed file descriptor does not
> return an error.

This is correct behaviour

> allow this behavior, the standards are wrong. No 'C' runtime library
> that I have checked during the past two weeks has allowed this behavior.

Its also a performance and scaling issue.

> 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
to the fwrite after fclose. That standard, sensibly, does not define what
happens when you feed it stupid random pointers.

File handles are strictly defined, and a write() to a closed file handle returns
-EBADF.

Alan


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