From 0dfaa54eea98ce326a37a5c35e589fbf2cd34003 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Thu, 23 Sep 2021 06:38:57 +0000 Subject: _syscall_mount(): ignore trailing slash in mount path --- src/kernel/syscalls.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/kernel/syscalls.c') diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index af3e0aa..1b91eb7 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -103,7 +103,13 @@ int _syscall_mount(handle_t handle, const char __user *path, int len) { goto fail; len = path_simplify(path_buf, path_buf, len); if (len < 0) goto fail; - // TODO remove trailing slash + + // remove trailing slash + // mounting something under `/this` and `/this/` should be equalivent + if (path_buf[len - 1] == '/') { + if (len == 0) goto fail; + len--; + } if (handle >= 0) { // mounting a real backend? if (handle >= HANDLE_MAX) -- cgit v1.2.3