diff options
Diffstat (limited to 'lash.c')
-rw-r--r-- | lash.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -970,10 +970,10 @@ static int expand_arguments(char *command) | |||
970 | { | 970 | { |
971 | 971 | ||
972 | int flags = GLOB_NOCHECK|GLOB_BRACE|GLOB_TILDE; | 972 | int flags = GLOB_NOCHECK|GLOB_BRACE|GLOB_TILDE; |
973 | char * tmpcmd; | 973 | char * tmpcmd, *cmd, *cmd_copy; |
974 | /* We need a clean copy, so strsep can mess up the copy while | 974 | /* We need a clean copy, so strsep can mess up the copy while |
975 | * we write stuff into the original (in a minute) */ | 975 | * we write stuff into the original (in a minute) */ |
976 | char * cmd = strdup(command); | 976 | cmd = cmd_copy = strdup(command); |
977 | *command = '\0'; | 977 | *command = '\0'; |
978 | for (tmpcmd = cmd; (tmpcmd = strsep(&cmd, " \t")) != NULL;) { | 978 | for (tmpcmd = cmd; (tmpcmd = strsep(&cmd, " \t")) != NULL;) { |
979 | if (*tmpcmd == '\0') | 979 | if (*tmpcmd == '\0') |
@@ -1006,7 +1006,7 @@ static int expand_arguments(char *command) | |||
1006 | globfree (&expand_result); | 1006 | globfree (&expand_result); |
1007 | } | 1007 | } |
1008 | } | 1008 | } |
1009 | free(cmd); | 1009 | free(cmd_copy); |
1010 | trim(command); | 1010 | trim(command); |
1011 | } | 1011 | } |
1012 | 1012 | ||