diff --git a/src/userprog/process.c b/src/userprog/process.c index cecedc1..20f2f3c 100644 --- a/src/userprog/process.c +++ b/src/userprog/process.c @@ -85,12 +85,11 @@ process_execute (const char *cmd) /* NOTE: Currently, the file being executed is closed in load () and then reopened here. Because load is an exported public function, this might be necessary. */ -struct file *exec_file = filesys_open (file_name); -file_deny_write (exec_file); - -/* Validates that the current file to be executed is a valid file */ -if (filesys_open (file_name) == NULL) - return TID_ERROR; + lock_acquire (&filesys_lock); + /* Validates that the current file to be executed is a valid file */ + if (filesys_open (file_name) == NULL) + return TID_ERROR; + lock_release (&filesys_lock); /* Create a new thread to execute the command, by initializing it running the function 'start_process' with the appropriate