[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG]? Strange return values of close()
From: |
arnold |
Subject: |
Re: [BUG]? Strange return values of close() |
Date: |
Fri, 11 Feb 2022 00:53:33 -0700 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
Hi.
"Andrew J. Schorr" <aschorr@telemetry-investments.com> wrote:
> I added a test case and pushed it.
Great! Thanks.
> I considered an alternative
> patch to gawk_pclose to call sanitize_exit_status there, but
> it seemed inconsistent to save struct redirect status values
> in some cases pre-sanitization and other cases post-sanitization.
I agree with what you did.
> By the way, in io.c:close_rp, there's a spot where it says:
> status = sanitize_exit_status(pclose(rp->output.fp));
> Is it OK to call sanitize_exit_status on the value returned by pclose?
> From the pclose man page:
> The pclose() function returns -1 if wait4(2) returns an error, or some
> other error is detected. In the event of an error, these functions set
> errno to indicate the cause of the error.
My man page says:
The pclose() function waits for the associated process to terminate and
returns the exit status of the command as returned by wait4(2).
So it's exactly the right thing to do to call sanitize_exit_status.
Thanks!
Arnold