return code from close
lcc.dab at UCLA-LOCUS.ARPA
lcc.dab at UCLA-LOCUS.ARPA
Thu Jul 26 10:29:07 AEST 1984
From: David Butterfield <lcc.dab at UCLA-LOCUS.ARPA>
Generally, people don't care what close returns. Close is only
supposed to fail if the file isn't open.
While this is true in most versions of Unix, it shouldn't be.
Since most writes to files don't occur until after the write system call
has returned to the user, any error can only be reflected at a later
time. One way is for the system to give an error indication on future
writes to that file, or upon close if no further writes are forthcoming.
In this way, device errors during delayed writes to files can be
reported to the user. This is in fact how it is done in some versions
of Unix.
Programs which check the return code from close will automatically take
advantage of systems which implement this feature. It doesn't hurt on
those systems which do not provide this error information.
Of course, there are still multitudes of programs which don't bother
checking for write errors, either. Sigh.
Dave
More information about the Comp.unix.wizards
mailing list