diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel/syscalls.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 285ce58..ffacdbc 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -155,9 +155,13 @@ int _syscall_write(handle_t handle_num, const void __user *buf, size_t len, int }); } -int _syscall_close(handle_t handle) { - if (handle < 0 || handle >= HANDLE_MAX) return -1; - return -1; +int _syscall_close(handle_t hid) { + if (hid < 0 || hid >= HANDLE_MAX) return -1; + struct handle **h = &process_current->handles[hid]; + if (!*h) return -1; + handle_close(*h); + *h = NULL; + return 0; } handle_t _syscall_fs_fork2(void) { |