This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libiberty patch] PEX-unix forking
- From: "Ian Lance Taylor via gcc-patches" <gcc-patches at gcc dot gnu dot org>
- To: Nathan Sidwell <nathan at acm dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 20 Aug 2018 14:36:40 -0700
- Subject: Re: [libiberty patch] PEX-unix forking
- References: <593c010d-0d12-cbf9-e1a9-e0f3108ffdf8@acm.org>
- Reply-to: Ian Lance Taylor <iant at google dot com>
On Mon, Aug 20, 2018 at 10:38 AM, Nathan Sidwell <nathan@acm.org> wrote:
>
> This is the first of a pair of patches I've had on the modules branch for a
> while. They improve the error behaviour in the case of child failure when
> vfork is the forking mechanism.
>
> This one commonizes the error paths in the parent and child to a pair of
> single blocks that print or return the error respectively. Currently each
> error case calls pex_child_error, or returns the error in the parent.
>
> The patch records the name of a failing system call, and uses that to print
> or return the error. It doesn't change functionality but will simplify the
> next patch that does.
>
> booted on x86_64-linux (which uses vfork), ok?
+ if (!bad_fn && in != STDIN_FILE_NO && close (in) < 0)
+ bad_fn = "close";
As a matter of style I don't personally like the pattern in which a
condition has both tests and actions. It's too easy to miss the
action. I would prefer to see this more like the original code:
if (!bad_fn && in != STDIN_FILE_NO)
{
if (close(in) < 0)
bad_fn = "close";
}
This is OK with those changes.
Thanks.
Ian