[PATCH] stdio: Do not ignore posix_spawn error on popen (BZ #29016)
Andreas Schwab
schwab@suse.de
Tue Dec 6 16:53:52 GMT 2022
On Dez 06 2022, Adhemerval Zanella wrote:
> To correctly return error in case of default shell is not present.
Ok.
> diff --git a/libio/iopopen.c b/libio/iopopen.c
> index 06778cf110..e4be6c9779 100644
> --- a/libio/iopopen.c
> +++ b/libio/iopopen.c
> @@ -66,11 +66,12 @@ unlock (void *not_used)
> be close (by transversing the proc_file_chain list) and the insertion of a
> new one after a successful posix_spawn this function should be called
> with proc_file_chain_lock acquired. */
> -static bool
> +static int
> spawn_process (posix_spawn_file_actions_t *fa, FILE *fp, const char *command,
> int do_cloexec, int pipe_fds[2], int parent_end, int child_end,
> int child_pipe_fd)
> {
> + int err = 0;
I don't think this needs to be initialized here.
> diff --git a/stdio-common/tst-popen3.c b/stdio-common/tst-popen3.c
> new file mode 100644
> index 0000000000..add5e97c09
> --- /dev/null
> +++ b/stdio-common/tst-popen3.c
> @@ -0,0 +1,38 @@
> +/* Check if popen return a correct error code if the default shell does not
s/return/returns/
> + exists (BZ#29016).
s/exists/exist/
--
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