filters
Tom Christiansen
tchrist at convex.com
Sun Dec 2 12:00:15 AEST 1990
There seem to be a lot of filters out there that don't check that their
output succeeded and blindly exit with success irrespective of the
success of their writes.
Cat and col are two utilities I've just caught doing this. Cat does
make a stab at detecting this, but it does it wrong. It just checks
ferror(stdout), but it's never done an fflush() or an fclose() first.
Plus it only says "output write error", not what the error is.
My first question I have is what could possible break if cat were to do
an fclose(stdout) at the end (and check the status and set the exit
accordingly).
(We know it really needs the fclose and not just fflush because of the
recent EDQUOTA debate, right?)
My second question is whether this is just a symptom of sloppy programming
or whether there's some reason why filters (mis)behave this way.
thanks,
--tom
More information about the Comp.unix.programmer
mailing list