[Tarantool-patches] [PATCH 1/2] popen: do not require space for shell args
Alexander Turenko
alexander.turenko at tarantool.org
Thu Mar 26 03:23:14 MSK 2020
I still think that we should remove the POPEN_FLAG_SHELL option,
because, in brief, it will simplify the popen engine API (see the last
point in [1]), but okay: let's proceed with the fix and postpone the
decision a bit.
LGTM.
[1]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-March/014608.html
On Tue, Mar 24, 2020 at 01:03:46PM +0300, Cyrill Gorcunov wrote:
> In case of direct execute without using a shell there
> is no need to require a caller to allocate redundant
> space, lets pass executable name in first argument.
>
> Since this is yet testing api we're allowed to change
> without breaking aything.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
> ---
> src/lib/core/popen.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c
> index a0630e3d9..6b6062215 100644
> --- a/src/lib/core/popen.c
> +++ b/src/lib/core/popen.c
> @@ -945,7 +945,7 @@ popen_new(struct popen_opts *opts)
> if (opts->flags & POPEN_FLAG_SHELL)
> execve(_PATH_BSHELL, opts->argv, envp);
> else
> - execve(opts->argv[2], &opts->argv[2], envp);
> + execve(opts->argv[0], opts->argv, envp);
> exit_child:
> _exit(errno);
> unreachable();
> --
> 2.20.1
>
More information about the Tarantool-patches
mailing list