Fix Bug in fd_get_file: In case fd not found, then returns NULL, w/ E
This commit is contained in:
@@ -340,6 +340,9 @@ fd_get_file (int fd)
|
|||||||
struct hash_elem *e
|
struct hash_elem *e
|
||||||
= hash_find (&thread_current ()->open_files, &fake_file_info.elem);
|
= hash_find (&thread_current ()->open_files, &fake_file_info.elem);
|
||||||
|
|
||||||
|
if (e == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return hash_entry (e, struct open_file, elem);
|
return hash_entry (e, struct open_file, elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user