summaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
authordzwdz2022-10-08 16:09:04 +0200
committerdzwdz2022-10-08 20:05:28 +0200
commit06affde06e2b1d3fe9c7c3fa60f5662e9957534d (patch)
tree5f4409a556b0edf62044dd608d8c798a0d09f005 /src/kernel
parentf25b6a7d38f1a4b656e3a7ad431afcf535f1fdce (diff)
syscall/open: don't check for free handles
doesn't really prevent anything, and makes it harder to test edge cases
Diffstat (limited to 'src/kernel')
-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;
}