aboutsummaryrefslogtreecommitdiff
path: root/kernel/api/syscall.c
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2024-05-13 12:10:55 +0000
committersotech117 <michael_foiani@brown.edu>2024-05-13 12:10:55 +0000
commit7585cb5ad84babe9db8c6595de464e33fb878f0c (patch)
tree3acdd29920420ca341ea7e3f90d60b16c384ce51 /kernel/api/syscall.c
parentf09878f6327426631d9419d825a4e8396e3b9dc4 (diff)
s5 fixes and issues with weenix
Diffstat (limited to 'kernel/api/syscall.c')
-rw-r--r--kernel/api/syscall.c10
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;
}
/*