From 83f222dba4449ba7135fff477e1ba247658b1a1c Mon Sep 17 00:00:00 2001
From: Alex Stratford <alexander3.stratford@live.uwe.ac.uk>
Date: Wed, 4 Dec 2019 10:18:15 +0000
Subject: [PATCH] Modified syscall_open syscall_open.c line 14: Commented out
 current code line 18: Changed to create new file struct line 19: Changed to
 use file struct and brace guard statement line 21: Added return to exit early
 line 22: Closing brace for guard statement line 23: Commented out old code
 line 24: Returning pointer to file struct

---
 userprog/syscall_open.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/userprog/syscall_open.c b/userprog/syscall_open.c
index 992856b..783c561 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
-- 
GitLab