diff options
author | dzwdz | 2021-09-23 06:38:57 +0000 |
---|---|---|
committer | dzwdz | 2021-09-23 06:38:57 +0000 |
commit | 0dfaa54eea98ce326a37a5c35e589fbf2cd34003 (patch) | |
tree | ad4387df218d7be3ca2654172ae8b511bb4a2c0c /src/kernel/syscalls.c | |
parent | 3d355852609a21da3285c938653bb487009ae293 (diff) |
_syscall_mount(): ignore trailing slash in mount path
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 8 |
1 files changed, 7 insertions, 1 deletions
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) |