summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/kernel/syscalls.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index 4718b4b..93f7e44 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -70,12 +70,13 @@ handle_t _syscall_fs_open(const user_ptr path, int len) {
struct virt_iter iter;
struct vfs_mount *mount;
static char buffer[PATH_MAX]; // holds the path
- int handle, res;
+ int res;
if (len > PATH_MAX) return -1;
- // find the first free handle
- handle = process_find_handle(process_current);
+ // fail if there are no handles left
+ if (process_find_handle(process_current) < 0)
+ return -1;
// copy the path to the kernel
virt_iter_new(&iter, path, len, process_current->pages, true, false);