summaryrefslogtreecommitdiff
path: root/src/kernel/syscalls.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r--src/kernel/syscalls.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index da6b48f..9b0746a 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -63,7 +63,7 @@ hid_t _sys_open(const char __user *path, long len, int flags) {
if (flags & ~(OPEN_RW | OPEN_CREATE)) SYSCALL_RETURN(-ENOSYS);
if (PATH_MAX < len)
- SYSCALL_RETURN(-1);
+ SYSCALL_RETURN(-ENAMETOOLONG);
/* Doesn't check for free handles. Another thread could use up all
* handles in the meantime anyways, or free some up. */
@@ -86,16 +86,16 @@ hid_t _sys_open(const char __user *path, long len, int flags) {
}
vfsreq_create((VfsReq) {
- .type = VFSOP_OPEN,
- .input = {
- .kern = true,
- .buf_kern = path_buf,
- .len = len,
- },
- .caller = proc_cur,
- .backend = mount->backend,
- .flags = flags,
- });
+ .type = VFSOP_OPEN,
+ .input = {
+ .kern = true,
+ .buf_kern = path_buf,
+ .len = len,
+ },
+ .caller = proc_cur,
+ .backend = mount->backend,
+ .flags = flags,
+ });
return -1; // dummy
fail:
kfree(path_buf);
@@ -125,12 +125,14 @@ long _sys_mount(hid_t hid, const char __user *path, long len) {
}
Handle *handle = hs_get(proc_cur->hs, hid);
- if (!handle || handle->type != HANDLE_FS_FRONT)
- goto fail;
- backend = handle->backend;
- if (backend) {
- assert(backend->usehcnt);
- backend->usehcnt++;
+ if (handle && handle->type == HANDLE_FS_FRONT) {
+ backend = handle->backend;
+ if (backend) {
+ assert(backend->usehcnt);
+ backend->usehcnt++;
+ }
+ } else {
+ backend = NULL;
}
// append to mount list