From 7585cb5ad84babe9db8c6595de464e33fb878f0c Mon Sep 17 00:00:00 2001 From: sotech117 Date: Mon, 13 May 2024 12:10:55 +0000 Subject: s5 fixes and issues with weenix --- kernel/api/syscall.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'kernel/api/syscall.c') 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; } /* -- cgit v1.2.3-70-g09d2