Fix argv[0] bug

This commit is contained in:
Kevin Lange 2012-03-27 21:36:39 -05:00
parent 0ce4e02cba
commit 958262e69d
2 changed files with 2 additions and 2 deletions

View File

@ -112,7 +112,7 @@ exec(
uintptr_t heap = current_process->image.entry + current_process->image.size;
alloc_frame(get_page(heap, 1, current_directory), 0, 1);
char ** argv_ = (char **)heap;
heap += sizeof(char *) * argc;
heap += sizeof(char *) * (argc + 1);
for (int i = 0; i < argc; ++i) {
alloc_frame(get_page(heap, 1, current_directory), 0, 1);
argv_[i] = (char *)heap;

View File

@ -3,7 +3,7 @@
int main(int argc, char * argv[]) {
printf("argc = %d\n", argc);
for (int i = 0; i < argc; ++i) {
printf("argv[%d]= %s\n", i, argv[i]);
printf("%p argv[%d]= %s\n", argv[i], i, argv[i]);
}
printf("continuing until I hit a 0\n");
int i = argc;