diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_descrip.c | 7 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 14 |
2 files changed, 14 insertions, 7 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index adc5027..c3d9b5c 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -208,17 +208,12 @@ int fd_open(const char *pathname, int flags) { int error; - char pathbuf[PATH_MAX]; struct filedesc *filedes; struct nameidata nd; - nd.path = pathbuf; + nd.path = pathname; nd.flags = 0; - if (copyinstr(pathname, pathbuf, PATH_MAX) < 0) { - return -EFAULT; - } - if ((error = namei(&nd)) < 0) { return error; } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 0ef3d42..fc85759 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -83,6 +83,18 @@ vfs_dostat(const char *path, struct stat *sbuf) return 0; } +static int +vfs_doopen(const char *pathname, int flags) +{ + char pathbuf[PATH_MAX]; + + if (copyinstr(pathname, pathbuf, PATH_MAX) < 0) { + return -EFAULT; + } + + return fd_open(pathbuf, flags); +} + /* * arg0: pathname * arg1: oflags @@ -92,7 +104,7 @@ vfs_dostat(const char *path, struct stat *sbuf) scret_t sys_open(struct syscall_args *scargs) { - return fd_open((char *)scargs->arg0, scargs->arg1); + return vfs_doopen((char *)scargs->arg0, scargs->arg1); } /* |