diff --git a/userprog/syscall_filesize.c b/userprog/syscall_filesize.c index ab74aadcacf00c85bc3125bd55b2b77534aae809..cdf87d038feca3cebc55f381a13e288a5eca11c9 100644 --- a/userprog/syscall_filesize.c +++ b/userprog/syscall_filesize.c @@ -2,10 +2,12 @@ #include "filesys/file.h" int syscall_filesize(struct intr_frame *file_descriptor) { - struct file_map *file_map = get_file(file_descriptor); // Described in system_calls.h, stores file descriptors mapped to files + // Described in system_calls.h, stores file descriptors mapped to files + struct file_map *file_map = get_file(file_descriptor); int size; if (file_map == NULL) // Checking if file is empty or non-existent - return -1; - size = file_length(file_map->file); // Using the file_length function in file.h to get the length and store it + return -1; // Returning failure state + // Using the file_length function in file.h to get the length and store it + size = file_length(file_map->file); return size; } \ No newline at end of file