James Youngman wrote:
> * lib/closeout.c (close_stdout): Don't signal an error closing
> stdout or stderr if it was already closed.
> * lib/closein.c (close_stdin): Don't signal an error closing stdin
> if it was already closed.
> * lib/close-stream.c (close_stream): Make boolean variables const
> to document the fact that we set but do not change them.

Hi James,

Thanks for the patch, but why do you want to do that?

Here are examples showing why we should keep the existing behavior.
Currently, cp diagnoses failure to write verbose output to a closed stdout:

    $ cp --verbose a b >&-
    cp: write error: Bad file descriptor

But with your patch, it would fail to detect/diagnose that error.
Obviously that is rather contrived, but coreutils' printf is in the same boat:

    $ env printf foo >&-
    printf: write error: Bad file descriptor
    [Exit 1]

Yet with your patch, it would succeed in spite of the
fact that it printed nothing to stdout.

However, the const-adding part of your patch would be find all by itself.


Reply via email to