This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [libiberty patch] PEX-unix forking


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]