summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd/tests/kernel/fs.c8
-rw-r--r--src/kernel/syscalls.c4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/cmd/tests/kernel/fs.c b/src/cmd/tests/kernel/fs.c
index b5684d7..449ed43 100644
--- a/src/cmd/tests/kernel/fs.c
+++ b/src/cmd/tests/kernel/fs.c
@@ -71,9 +71,15 @@ static void test_fs_cleanup(void) {
}
}
+static void test_no_fs(void) {
+ char buf[256];
+ struct ufs_request res;
+ test(_sys_fs_wait(buf, 256, &res) == -EPIPE);
+}
+
void r_k_fs(void) {
run_test(test_unfinished_req);
run_test(test_orphaned_fs);
run_test(test_fs_cleanup);
- run_test(test_fs_cleanup);
+ run_test(test_no_fs);
}
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index 343f45c..de53062 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -256,9 +256,7 @@ long _sys_close(hid_t hid) {
hid_t _sys_fs_wait(char __user *buf, long max_len, struct ufs_request __user *res) {
VfsBackend *backend = proc_cur->controlled;
- // TODO can be used to tell if you're init
- if (!backend) SYSCALL_RETURN(-1);
- if (backend->usehcnt == 0) {
+ if (!backend || backend->usehcnt == 0) {
/* nothing on the other end. EPIPE seems fitting */
SYSCALL_RETURN(-EPIPE);
}