diff options
Diffstat (limited to 'kernel/api/syscall.c')
-rw-r--r-- | kernel/api/syscall.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/api/syscall.c b/kernel/api/syscall.c index e077631..467b7d6 100644 --- a/kernel/api/syscall.c +++ b/kernel/api/syscall.c @@ -85,15 +85,15 @@ static long sys_read(read_args_t *args) } // Call do_read() with the buffer and then copy the buffer to the userland args after the system call - ret = do_read(kargs.fd, addr, kargs.nbytes); + ssize_t bytes_read = do_read(kargs.fd, addr, kargs.nbytes); // if ret < 0, free the temporary buffer and return -1 - if (ret < 0) + if (bytes_read < 0) { page_free_n(addr, size_in_pages); - ERROR_OUT_RET(ret); + ERROR_OUT_RET(bytes_read); } // if read nothing, free the temporary buffer and return 0 - if (ret == 0) + if (bytes_read == 0) { page_free_n(addr, size_in_pages); return 0; @@ -110,7 +110,7 @@ static long sys_read(read_args_t *args) // Make sure to free the temporary buffer allocated page_free_n(addr, size_in_pages); - return ret; + return bytes_read; } /* |