summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/tmpfs/tmpfs_subr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/tmpfs/tmpfs_subr.c b/sys/tmpfs/tmpfs_subr.c
index 3e92d11dff0..baf119f5695 100644
--- a/sys/tmpfs/tmpfs_subr.c
+++ b/sys/tmpfs/tmpfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmpfs_subr.c,v 1.8 2014/11/18 02:37:31 tedu Exp $ */
+/* $OpenBSD: tmpfs_subr.c,v 1.9 2014/12/04 08:19:03 dcoppa Exp $ */
/* $NetBSD: tmpfs_subr.c,v 1.79 2012/03/13 18:40:50 elad Exp $ */
/*
@@ -398,6 +398,11 @@ tmpfs_alloc_file(struct vnode *dvp, struct vnode **vpp, struct vattr *vap,
goto out;
}
+ if (dnode->tn_links == 0) {
+ error = ENOENT;
+ goto out;
+ }
+
/* Allocate a node that represents the new file. */
error = tmpfs_alloc_node(tmp, vap->va_type, cnp->cn_cred->cr_uid,
dnode->tn_gid, vap->va_mode, target, vap->va_rdev, &node);