summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_syscalls.c
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2019-07-15 14:56:46 +0000
committerBob Beck <beck@cvs.openbsd.org>2019-07-15 14:56:46 +0000
commitd84caab08d863c01dbc99f4e319f0629d9133b67 (patch)
treec8ff15ded59f038635729f0507298ebdaa3e2e72 /sys/kern/vfs_syscalls.c
parent422c48b838619d2796dee8973524e6fd2a3d8e45 (diff)
Make realpath posixly correct by changing the kernel implementation
to not succeed on final path components that do not exist. The original implmentation succeeded in these cases. ok bluhm@
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r--sys/kern/vfs_syscalls.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index b2aa8939001..6d105ae9b16 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.321 2019/07/12 13:56:27 solene Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.322 2019/07/15 14:56:45 beck Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -928,7 +928,7 @@ sys___realpath(struct proc *p, void *v, register_t *retval)
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | SAVENAME | REALPATH,
UIO_SYSSPACE, pathname, p);
else
- NDINIT(&nd, CREATE, FOLLOW | LOCKLEAF | LOCKPARENT | SAVENAME |
+ NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | LOCKPARENT | SAVENAME |
REALPATH, UIO_SYSSPACE, pathname, p);
nd.ni_cnd.cn_rpbuf = rpbuf;
@@ -2083,7 +2083,7 @@ doreadlinkat(struct proc *p, int fd, const char *path, char *buf,
NDINITAT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE, fd, path, p);
nd.ni_pledge = PLEDGE_RPATH;
- nd.ni_unveil = UNVEIL_INSPECT;
+ nd.ni_unveil = UNVEIL_READ;
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;