diff --git a/linux-user/main.c b/linux-user/main.c index 923cbb753a..dd6a22f95f 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -737,6 +737,19 @@ int main(int argc, char **argv, char **envp) /* * Prepare copy of argv vector for target. */ + /*lpeng add for test, here we have already got filename/exec_path as argv[1], + * if argv[2] equal to "MISC_FMT_PRESERVE_ARGV0" it's a token of binfmt_misc with flag P + * the real input commands are start from argv[3],add two to optind here + * */ + if(argv[optind+1] != NULL) + { + if(!strcmp(argv[optind+1], "MISC_FMT_PRESERVE_ARGV0")) + { + optind += 2; + } + } + + target_argc = argc - optind; target_argv = calloc(target_argc + 1, sizeof (char *)); if (target_argv == NULL) {