diff options
author | dzwdz | 2024-08-17 17:17:12 +0200 |
---|---|---|
committer | dzwdz | 2024-08-17 17:17:12 +0200 |
commit | fa792166e13115b4262e8533da2839518df3bfe3 (patch) | |
tree | ce0019f4406aa11bda8e36bedab11a2bfea181c1 | |
parent | 2ea826b428246eb62be81630f441a4367a675968 (diff) |
kernel: immediately fail open() request instead of truncating the path
less error prone
-rw-r--r-- | src/cmd/tests/kernel/fs.c | 3 | ||||
-rw-r--r-- | src/cmd/tests/kernel/path.c | 3 | ||||
-rw-r--r-- | src/kernel/vfs/request.c | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/src/cmd/tests/kernel/fs.c b/src/cmd/tests/kernel/fs.c index a19f3fb..42b069f 100644 --- a/src/cmd/tests/kernel/fs.c +++ b/src/cmd/tests/kernel/fs.c @@ -10,8 +10,9 @@ static void test_unfinished_req(void) { test(0 <= ret); if (ret == 0) { // TODO make a similar test with all 0s passed to fs_wait + char buf[512]; struct ufs_request res; - _sys_fs_wait(NULL, 0, &res); + _sys_fs_wait(buf, sizeof(buf), &res); exit(0); } else { test(0 <= h); diff --git a/src/cmd/tests/kernel/path.c b/src/cmd/tests/kernel/path.c index 5a22c36..215d36b 100644 --- a/src/cmd/tests/kernel/path.c +++ b/src/cmd/tests/kernel/path.c @@ -67,7 +67,8 @@ static void mount_resolve_drv(const char *path) { if (mount_at(path) != 0) return; struct ufs_request res; - while (!c0_fs_wait(NULL, 0, &res)) { + char buf[512]; + while (!c0_fs_wait(buf, sizeof(buf), &res)) { // TODO does the first argument of c0_fs_respond need to be non-const? c0_fs_respond((void*)path, strlen(path), 0); } diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index 50fcc22..4e8a162 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -155,7 +155,9 @@ vfsback_useraccept(VfsReq *req) len = req->kinlen; pcpy_to(handler, buf, req->kin, len+1); /* +1 for NUL */ } else { - panic_unimplemented(); // TODO! fail + // XXX this is an easy way to tell user fses apart from kernel fses + vfsreq_finish_short(req, -ENOENT); + return; } } else if (req->uin) { void __user *buf = handler->awaited_req.buf; |