Module Name:    src
Committed By:   pooka
Date:           Sun Apr  5 15:10:41 UTC 2009

Modified Files:
        src/sys/fs/tmpfs: tmpfs_vnops.c

Log Message:
Invariants should be tested for with KASSERT instead of semi-pretending
that them not holding is an acceptable error condition.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/fs/tmpfs/tmpfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/tmpfs/tmpfs_vnops.c
diff -u src/sys/fs/tmpfs/tmpfs_vnops.c:1.55 src/sys/fs/tmpfs/tmpfs_vnops.c:1.56
--- src/sys/fs/tmpfs/tmpfs_vnops.c:1.55	Fri Apr  3 14:47:40 2009
+++ src/sys/fs/tmpfs/tmpfs_vnops.c	Sun Apr  5 15:10:41 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vnops.c,v 1.55 2009/04/03 14:47:40 pooka Exp $	*/
+/*	$NetBSD: tmpfs_vnops.c,v 1.56 2009/04/05 15:10:41 pooka Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.55 2009/04/03 14:47:40 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.56 2009/04/05 15:10:41 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/dirent.h>
@@ -652,10 +652,7 @@
 	node = VP_TO_TMPFS_NODE(vp);
 	tmp = VFS_TO_TMPFS(vp->v_mount);
 	de = tmpfs_dir_lookup(dnode, cnp);
-	if (de == NULL) {
-		error = ENOENT;
-		goto out;
-	}
+	KASSERT(de);
 	KASSERT(de->td_node == node);
 
 	/* Files marked as immutable or append-only cannot be deleted. */
@@ -1031,10 +1028,7 @@
 
 	/* Get the directory entry associated with node (vp). */
 	de = tmpfs_dir_lookup(dnode, cnp);
-	if (de == NULL) {
-		error = ENOENT;
-		goto out;
-	}
+	KASSERT(de);
 	KASSERT(de->td_node == node);
 
 	/* Check flags to see if we are allowed to remove the directory. */

Reply via email to