From ec0c4f299c271f2472d67d336818e2505d19638a Mon Sep 17 00:00:00 2001
From: Alex Stratford <alexander3.stratford@live.uwe.ac.uk>
Date: Tue, 3 Dec 2019 20:25:09 +0000
Subject: [PATCH] Minor bug fixes

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

diff --git a/userprog/syscall_open.c b/userprog/syscall_open.c
index dcec481..386fa26 100644
--- a/userprog/syscall_open.c
+++ b/userprog/syscall_open.c
@@ -11,10 +11,11 @@
 #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
 	// pop off first int argument from interrupt frame
-	struct file_map *f_map->file_descriptor = *((int*)f->esp + 1);
+	f_map->file_descriptor = *((int*)f->esp + 1);
 	// Described in system_calls.h, opens the file
-	f_map->file = file_open(file_descriptor);	
+	f_map->file = file_open(f_map->file_descriptor);
 	if (f_map->file == NULL) // Checking if file is empty or non-existent
 		f->eax = -1; // Returning a failure state
 	f->eax = f_map->file_descriptor; // Returning the file descriptor
-- 
GitLab