summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2019-11-26 00:26:37 +0000
committerBob Beck <beck@cvs.openbsd.org>2019-11-26 00:26:37 +0000
commit90b57bdecc2f4dcfc4b29b2f73cc88d5fa0bceed (patch)
tree08994342624991696656724afb67f98463d0a5de /sys
parent04743d2fdb598cf9ae31969958e4548acfcfd357 (diff)
Don't use LOCKPARENT on namei calls for realpath(). We don't
require this anymore since we now behave like posix. Fixes a problem where a symlink to / would return ENOTDIR because the parent could not be locked - noticed by Raimo Niskanen <raimo@erlang.org> ok guenther@ deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_syscalls.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 23a96822126..ce04de981bd 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.336 2019/10/06 16:24:14 beck Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.337 2019/11/26 00:26:36 beck Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -928,13 +928,8 @@ sys___realpath(struct proc *p, void *v, register_t *retval)
if (*c != '/')
break;
}
- if (*c == '\0')
- /* root directory */
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | SAVENAME | REALPATH,
- UIO_SYSSPACE, pathname, p);
- else
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | LOCKPARENT | SAVENAME |
- REALPATH, UIO_SYSSPACE, pathname, p);
+ NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | SAVENAME | REALPATH,
+ UIO_SYSSPACE, pathname, p);
nd.ni_cnd.cn_rpbuf = rpbuf;
nd.ni_cnd.cn_rpi = strlen(rpbuf);
@@ -949,11 +944,6 @@ sys___realpath(struct proc *p, void *v, register_t *retval)
VOP_UNLOCK(nd.ni_vp);
vrele(nd.ni_vp);
}
- if (nd.ni_dvp && nd.ni_dvp != nd.ni_vp)
- VOP_UNLOCK(nd.ni_dvp);
- if (nd.ni_dvp)
- vrele(nd.ni_dvp);
-
error = copyoutstr(nd.ni_cnd.cn_rpbuf, SCARG(uap, resolved),
MAXPATHLEN, NULL);