summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-03-30 04:53:10 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-03-30 04:53:10 +0000
commit948afa3f155b10dd9d96ca0cda4864be73348e72 (patch)
treef4da7a47a954c6aba8963b668e0bf4f475069c3e /sys
parent57c02dcfb19c4c23819e6a6d1e494721c07edfc0 (diff)
Return ENOTDIR if an *at() syscall is passed a relative path and a
fd to resolve against that isn't a directory ok matthew@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_lookup.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 777b3b2aeaa..6086610680d 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_lookup.c,v 1.45 2011/07/22 00:22:57 matthew Exp $ */
+/* $OpenBSD: vfs_lookup.c,v 1.46 2013/03/30 04:53:09 guenther Exp $ */
/* $NetBSD: vfs_lookup.c,v 1.17 1996/02/09 19:00:59 christos Exp $ */
/*
@@ -174,14 +174,14 @@ namei(struct nameidata *ndp)
vref(dp);
} else {
struct file *fp = fd_getfile(fdp, ndp->ni_dirfd);
- if (fp == NULL || fp->f_type != DTYPE_VNODE) {
+ if (fp == NULL) {
pool_put(&namei_pool, cnp->cn_pnbuf);
return (EBADF);
}
dp = (struct vnode *)fp->f_data;
- if (dp->v_type != VDIR) {
+ if (fp->f_type != DTYPE_VNODE || dp->v_type != VDIR) {
pool_put(&namei_pool, cnp->cn_pnbuf);
- return (EBADF);
+ return (ENOTDIR);
}
vref(dp);
}