Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Make sure that a sysctlnode's child nodes, even nod...



details:   https://anonhg.NetBSD.org/src/rev/941a23511e7c
branches:  trunk
changeset: 746861:941a23511e7c
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Fri Aug 21 22:43:32 2009 +0000

description:
Make sure that a sysctlnode's child nodes, even nodes that are not
yet in service, have a correct pointer to their parent, sysctl_parent.
This fixes a bug where sysctl_teardown(9) could not clean up a
network interface's sysctl(9) trees when I detached it, because
the wrong log had been recorded.

diffstat:

 sys/kern/kern_sysctl.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 2fa6febef087 -r 941a23511e7c sys/kern/kern_sysctl.c
--- a/sys/kern/kern_sysctl.c    Fri Aug 21 21:12:02 2009 +0000
+++ b/sys/kern/kern_sysctl.c    Fri Aug 21 22:43:32 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sysctl.c,v 1.222 2009/04/15 20:44:25 elad Exp $   */
+/*     $NetBSD: kern_sysctl.c,v 1.223 2009/08/21 22:43:32 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.222 2009/04/15 20:44:25 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.223 2009/08/21 22:43:32 dyoung Exp $");
 
 #include "opt_defcorename.h"
 #include "ksyms.h"
@@ -1143,8 +1143,8 @@
                 * and...reparent any children of any moved nodes
                 */
                for (ni = at; ni <= pnode->sysctl_clen; ni++)
-                       if (SYSCTL_TYPE(node[ni].sysctl_flags) == CTLTYPE_NODE)
-                               for (t = 0; t < node[ni].sysctl_clen; t++)
+                       if (node[ni].sysctl_child != NULL)
+                               for (t = 0; t < node[ni].sysctl_csize; t++)
                                        node[ni].sysctl_child[t].sysctl_parent =
                                                &node[ni];
        }



Home | Main Index | Thread Index | Old Index