On Thu, Apr 21, 2011 at 12:00 AM, Philip Guenther <guent...@gmail.com> wrote:
> Why is that a mistake?
>
> It appears you're saying that make should complain about failures to
> write to stdout for reasons like EIO, ENOSPC,  and EOVERFLOW, but
> *not* for EBADF.

I think you're still not getting my point here. I do not believe this
has anything to do with *writes* at all, failed or otherwise. Make is
attempting to close something that's already closed and complaining
when it doesn't work. POSIX is quite clear that fclose on a closed
stream results in an error condition.

> (Actually, your patch doesn't just ignore EBADF errors: it ignores
> EPIPE errors, as the ftell() will fail on the pipe.  Why is that a
> good idea?)

You're right on this. An earlier version of my change, when it was
implemented within close_stdout(), looked something like

    if (ftell(stdout) == -1 && errno == EBADF) ...

but I lost the EBADF test when I redid it. That was a mistake, and
maybe there's a better way of checking for closure than ftell anyway,
but the basic point of not closing something unless it was open
remains.

David B

_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to