diff --git a/userprog/syscall_open.c b/userprog/syscall_open.c index 992856b6032918ad6960b1e894de7b021da6ff68..783c561f5c0529c95ae606a3a5e8371a5306b4d2 100644 --- a/userprog/syscall_open.c +++ b/userprog/syscall_open.c @@ -11,13 +11,15 @@ #include "filesys/file.h" // Dependency for file_open and file struct void syscall_open(struct intr_frame *f) { - struct file_map *f_map; // Create f_map struct instance + //struct file_map f_map; // Create f_map struct instance // pop off first int argument from interrupt frame char* file_name = (void*)(*(int*)f->esp + 1); // Described in system_calls.h, opens the file - f_map->file = file_open(file_name); - if (f_map->file == NULL) // Checking if file is empty or non-existent + struct file *file = file_open(file_name); + if (file == NULL) { // Checking if file is empty or non-existent f->eax = -1; // Returning a failure state - f_map->file_descriptor = f_map->file; - f->eax = f_map->file_descriptor; // Returning the file descriptor + return; + } + //f_map.file_descriptor = f_map.file; + f->eax = file;//f_map.file_descriptor; // Returning the file descriptor } \ No newline at end of file