[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Don't error out if stdin/stdout/stderr was already closed.
From: |
Jim Meyering |
Subject: |
Re: [PATCH] Don't error out if stdin/stdout/stderr was already closed. |
Date: |
Sun, 11 Apr 2010 14:06:00 +0200 |
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.
- [PATCH] Don't error out if stdin/stdout/stderr was already closed., James Youngman, 2010/04/11
- Re: [PATCH] Don't error out if stdin/stdout/stderr was already closed.,
Jim Meyering <=
- Re: const local variables, Bruno Haible, 2010/04/11
- Re: const local variables, James Youngman, 2010/04/11
- Re: const local variables, Jim Meyering, 2010/04/11
- Re: const local variables, Paul Eggert, 2010/04/11
- "const" scalars, Jim Meyering, 2010/04/12
- Re: "const" scalars, Ben Pfaff, 2010/04/12
- Re: "const" scalars, Jim Meyering, 2010/04/12