[Tarantool-patches] [PATCH 1/2] popen: do not require space for shell args
Cyrill Gorcunov
gorcunov at gmail.com
Tue Mar 24 13:03:46 MSK 2020
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