This commit is contained in:
Kartik Singh 2024-12-18 06:42:41 -08:00 committed by GitHub
commit 51fd98d680
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -576,11 +576,12 @@ notfound:
char **shell_build_argv(const char *cmd, const char *extra_args)
FUNC_ATTR_NONNULL_RET
{
size_t argc = tokenize(p_sh, NULL) + (cmd ? tokenize(p_shcf, NULL) : 0);
size_t argc = 1 + (cmd ? tokenize(p_shcf, NULL) : 0);
char **rv = xmalloc((argc + 4) * sizeof(*rv));
// Split 'shell'
size_t i = tokenize(p_sh, rv);
size_t i = 0;
rv[i++] = vim_strnsave_unquoted((const char *) p_sh,
strlen((const char *) p_sh));
if (extra_args) {
rv[i++] = xstrdup(extra_args); // Push a copy of `extra_args`