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 2/3] posix: Improve default posix_spawn implementation


On Mai 15 2017, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> +		    if ((ret = close_not_cancel (new_fd) != 0))

This assigns the wrong value to ret.

> +fail:
> +  /* Since sizeof errno < PIPE_BUF, the write is atomic. */
> +  ret = -ret;

posix_spwan is supposed to return errno, but none of the arms going here
set ret appropriately.

> +  /* Generate the new process.  */
> +  pid_t new_pid = __fork ();
> +
> +  if (new_pid == 0)
> +    __spawni_child (&args);
> +  else if (new_pid > 0)
> +    {
> +      __close (args.pipe[1]);
> +
> +      if (__read (args.pipe[0], &ec, sizeof ec) != sizeof ec)
> +	ec = 0;
> +      else
> +	__waitpid (new_pid, &(int) { 0 }, 0);
>      }
> -  while (*p++ != '\0');
> +  else
> +    ec = -new_pid;

new_pid isn't an errno either.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


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