summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/kernel/syscalls.c5
-rw-r--r--src/kernel/vfs/request.c1
2 files changed, 3 insertions, 3 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index 1909eb7..6800138 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -86,9 +86,8 @@ handle_t _syscall_open(const char __user *path, long len, int flags) {
if (PATH_MAX < len)
SYSCALL_RETURN(-1);
- // TODO remove this check - it's not worth it w/ threads
- if (process_find_free_handle(process_current, 0) < 0)
- SYSCALL_RETURN(-EMFILE);
+ /* Doesn't check for free handles. Another thread could use up all
+ * handles in the meantime anyways, or free some up. */
path_buf = kmalloc(len);
if (!path_buf) goto fail;
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c
index 0a377d3..a129f2e 100644
--- a/src/kernel/vfs/request.c
+++ b/src/kernel/vfs/request.c
@@ -64,6 +64,7 @@ void vfsreq_finish(struct vfs_request *req, char __user *stored, long ret,
// TODO write tests for caller getting killed while opening a file
if (!req->caller) panic_unimplemented();
ret = process_handle_put(req->caller, h);
+ if (ret < 0) ret = -EMFILE;
} else {
ret = -1;
}