This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: [PATCH v2 3/3] posix: New Linux posix_spawn{p} implementation


* Rasmus Villemoes:

> +  /* errno should have an appropriate non-zero value, but make sure
> +     that's the case so that our parent knows we failed to
> +     exec. There's no EUNKNOWN or EINTERNALBUG, so we use a value
> +     which is clearly bogus.  */
> +  args->err = errno ? : EHOSTDOWN;
>    _exit (SPAWN_ERROR);
>  }

I think ECHILD is probably a better fake error code.

You should set args->err to 0 on success ...

> +  args.err = 0;

... and initialize it to -1.

>    if (new_pid > 0)
>      {
> -      if (__read (args.pipe[0], &ec, sizeof ec) != sizeof ec)
> -    ec = 0;
> -      else
> +      ec = args.err;
> +      if (ec != 0)
>      __waitpid (new_pid, NULL, 0);
>      }

You should check (assert?) here that args.err is not -1.  Otherwise we
will never notice if the page is not shared between parent and child,
and the error reporting mechanism does not work.


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