summaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/exec.c b/exec.c
index 4d7d97c..b40134f 100644
--- a/exec.c
+++ b/exec.c
@@ -17,11 +17,13 @@ exec(char *path, char **argv)
struct inode *ip;
struct proghdr ph;
pde_t *pgdir, *oldpgdir;
+ struct proc *curproc = myproc();
begin_op();
if((ip = namei(path)) == 0){
end_op();
+ cprintf("exec: fail\n");
return -1;
}
ilock(ip);
@@ -89,15 +91,15 @@ exec(char *path, char **argv)
for(last=s=path; *s; s++)
if(*s == '/')
last = s+1;
- safestrcpy(proc->name, last, sizeof(proc->name));
+ safestrcpy(curproc->name, last, sizeof(curproc->name));
// Commit to the user image.
- oldpgdir = proc->pgdir;
- proc->pgdir = pgdir;
- proc->sz = sz;
- proc->tf->eip = elf.entry; // main
- proc->tf->esp = sp;
- switchuvm(proc);
+ oldpgdir = curproc->pgdir;
+ curproc->pgdir = pgdir;
+ curproc->sz = sz;
+ curproc->tf->eip = elf.entry; // main
+ curproc->tf->esp = sp;
+ switchuvm(curproc);
freevm(oldpgdir);
return 0;