This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/3] posix: Improve default posix_spawn implementation
- From: Andreas Schwab <schwab at suse dot de>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 29 Jun 2017 16:22:13 +0200
- Subject: Re: [PATCH 2/3] posix: Improve default posix_spawn implementation
- Authentication-results: sourceware.org; auth=none
- References: <1494876985-21990-1-git-send-email-adhemerval.zanella@linaro.org> <1494876985-21990-2-git-send-email-adhemerval.zanella@linaro.org>
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."