Module Name:    src
Committed By:   christos
Date:           Wed Nov 23 17:22:44 UTC 2016

Modified Files:
        src/usr.sbin/puffs/mount_sysctlfs: sysctlfs.c

Log Message:
- protect against node not found SEGV
- fix reversed logic; if we find it in the cache we return it, otherwise
  we create it.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c

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

Modified files:

Index: src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c
diff -u src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c:1.18 src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c:1.19
--- src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c:1.18	Thu Nov 12 11:51:18 2015
+++ src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c	Wed Nov 23 12:22:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysctlfs.c,v 1.18 2015/11/12 16:51:18 christos Exp $	*/
+/*	$NetBSD: sysctlfs.c,v 1.19 2016/11/23 17:22:44 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: sysctlfs.c,v 1.18 2015/11/12 16:51:18 christos Exp $");
+__RCSID("$NetBSD: sysctlfs.c,v 1.19 2016/11/23 17:22:44 christos Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -180,8 +180,8 @@ getnode(struct puffs_usermount *pu, stru
 	else
 		pn = puffs_pn_nodewalk(pu, puffs_path_walkcmp, po);
 
-	if (pn == NULL) 
-		return NULL;
+	if (pn != NULL) 
+		return pn;
 	/*
 	 * don't know nodetype?  query...
 	 *
@@ -580,6 +580,8 @@ sysctlfs_node_lookup(struct puffs_usermo
 		nodetype = CTLTYPE_NODE;
 
 	pn_new = getnode(pu, &p2cn->pcn_po_full, nodetype);
+	if (pn_new == NULL)
+		return ENOENT;
 	sfs_new = pn_new->pn_data;
 
 	puffs_newinfo_setcookie(pni, pn_new);

Reply via email to