- protect against node not found SEGV
- fix reversed logic; if we find it in the cache we return it, otherwise we create it.
This commit is contained in:
parent
b3d297ea4c
commit
07e020dd99
@ -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, struct puffs_pathobj *po, int nodetype)
|
||||
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_usermount *pu, void *opc,
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user