修改shell执行exec时传参错误问题 (#399)

* 修改shell执行exec时传参错误问题
This commit is contained in:
GnoCiYeH
2023-10-09 01:10:14 +08:00
committed by GitHub
parent b7b843bedd
commit 865f4ba4cd
3 changed files with 11 additions and 4 deletions

View File

@ -508,7 +508,12 @@ int shell_cmd_exec(int argc, char **argv)
char *file_path = get_target_filepath(argv[1], &path_len);
// printf("before execv, path=%s, argc=%d\n", file_path, argc);
execv(file_path, argv);
char **real_argv;
if (argc > 2)
{
real_argv = &argv[2];
}
execv(file_path, real_argv);
// printf("after execv, path=%s, argc=%d\n", file_path, argc);
free(argv);
free(file_path);