[PATCH 2/3] posix: Improve default posix_spawn implementation
Andreas Schwab
schwab@suse.de
Thu Jun 29 14:22:00 GMT 2017
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."
More information about the Libc-alpha
mailing list