X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/f8bd95b7a13dfe54d800e2d7ecdb0329f0798289..986ce23ace2f7875a1a561bd947f435a7594146c:/lunaix-os/kernel/mm/mmap.c diff --git a/lunaix-os/kernel/mm/mmap.c b/lunaix-os/kernel/mm/mmap.c index 383d83e..8eb7482 100644 --- a/lunaix-os/kernel/mm/mmap.c +++ b/lunaix-os/kernel/mm/mmap.c @@ -303,20 +303,19 @@ __DEFINE_LXSYSCALL3(void*, sys_mmap, void*, addr, size_t, length, va_list, lst) } } - struct v_fd* vfd; - if ((errno = vfs_getfd(fd, &vfd))) { - goto done; - } - - struct v_file* file = vfd->file; + struct v_file* file = NULL; if (!(options & MAP_ANON)) { + struct v_fd* vfd; + if ((errno = vfs_getfd(fd, &vfd))) { + goto done; + } + + file = vfd->file; if (!file->ops->read_page) { errno = ENODEV; goto done; } - } else { - file = NULL; } struct mmap_param param = { .flags = options,