bugfix: 解决shell在exec的时候传递的argv不正确的bug (#437)

This commit is contained in:
LoGin 2023-11-12 17:53:36 +08:00 committed by GitHub
parent 709498cac1
commit 4a2d7191a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -1175,15 +1175,14 @@ impl Syscall {
Self::get_rusage(who, rusage)
}
SYS_READLINK =>{
SYS_READLINK => {
let path = args[0] as *const u8;
let buf = args[1] as *mut u8;
let bufsiz = args[2] as usize;
Self::readlink(path, buf, bufsiz)
}
SYS_READLINK_AT =>{
SYS_READLINK_AT => {
let dirfd = args[0] as i32;
let pathname = args[1] as *const u8;
let buf = args[2] as *mut u8;

View File

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