changeset 13748:e5244201fed6 v8.0.1746

patch 8.0.1746: MS-Windows: channel tests fail commit https://github.com/vim/vim/commit/a69b39511d769bc88f0854bd026556fdb9bd2817 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 21 23:00:27 2018 +0200 patch 8.0.1746: MS-Windows: channel tests fail Problem: MS-Windows: channel tests fail. Solution: Make a copy of the command before splitting it.
author Christian Brabandt <cb@256bit.org>
date Sat, 21 Apr 2018 23:15:06 +0200
parents e6e08c0f9ef0
children f30ac8135299
files src/channel.c src/version.c
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -5563,6 +5563,8 @@ job_start(typval_T *argvars, char **argv
 #endif
     if (argvars[0].v_type == VAR_STRING)
     {
+	char_u	*cmd_copy;
+
 	/* Command is a string. */
 	cmd = argvars[0].vval.v_string;
 	if (cmd == NULL || *cmd == NUL)
@@ -5570,12 +5572,18 @@ job_start(typval_T *argvars, char **argv
 	    EMSG(_(e_invarg));
 	    goto theend;
 	}
-	/* This will modify "cmd". */
-	if (mch_parse_cmd(cmd, FALSE, &argv, &argc) == FAIL)
+	/* Make a copy, parsing will modify "cmd". */
+	cmd_copy = vim_strsave(cmd);
+	if (cmd_copy == NULL
+		|| mch_parse_cmd(cmd_copy, FALSE, &argv, &argc) == FAIL)
+	{
+	    vim_free(cmd_copy);
 	    goto theend;
+	}
 	for (i = 0; i < argc; i++)
 	    argv[i] = (char *)vim_strsave((char_u *)argv[i]);
 	argv[argc] = NULL;
+	vim_free(cmd_copy);
     }
     else if (argvars[0].v_type != VAR_LIST
 	    || argvars[0].vval.v_list == NULL
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1746,
+/**/
     1745,
 /**/
     1744,