summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_syscalls.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2007-08-06 16:58:27 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2007-08-06 16:58:27 +0000
commit602a7968e47e34fd38658741b7b66d3c9115f9cf (patch)
treebc787603663477c9baa82834b78a84bb39e7878b /sys/kern/vfs_syscalls.c
parentfd9da30339ae16bb1f626e662baec9f419539c17 (diff)
Fix error path in sys_fhopen() if VOP_ADVLOCK fails. Spotted by aaron@
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r--sys/kern/vfs_syscalls.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 5b425a0bb21..19706a0c923 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.140 2007/06/14 20:36:34 otto Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.141 2007/08/06 16:58:26 millert Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -1059,12 +1059,8 @@ sys_fhopen(struct proc *p, void *v, register_t *retval)
type |= F_WAIT;
VOP_UNLOCK(vp, 0, p);
error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, type);
- if (error) {
- /* closef will vn_close the file for us. */
- fdremove(fdp, indx);
- closef(fp, p);
- return (error);
- }
+ if (error)
+ goto bad;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
fp->f_flag |= FHASLOCK;
}