NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/43587: stupid error message during boot from sysctl if no COMPAT40 in kernel
The following reply was made to PR bin/43587; it has been noted by GNATS.
From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/43587: stupid error message during boot from sysctl if no
COMPAT40 in kernel
Date: Fri, 09 Jul 2010 20:50:39 +0700
For reference this is the (apologies, not even compile tested...) patch
I would make to handle the sysctl part of this problem, I think this
is entirely adequate.
Note: patch is for NetBSD current (this problem has about 0% chance of
ever getting fixed in the NetBSD 5.0 series - it isn't a serious enough
problem - the fix could get pulled up for eventual inclusion in 5.2
though - I'm pretty sure it will be too late for 5.1 already).
kre
--- sysctl.c 2010-04-12 15:59:19.000000000 +0700
+++ sysctl.c-fixed 2010-07-09 20:46:50.000000000 +0700
@@ -125,8 +125,8 @@
static void canonicalize(const char *, char *);
static void purge_tree(struct sysctlnode *);
static void print_tree(int *, u_int, struct sysctlnode *, u_int, int);
-static void write_number(int *, u_int, struct sysctlnode *, char *);
-static void write_string(int *, u_int, struct sysctlnode *, char *);
+static void write_number(int *, u_int, struct sysctlnode *, char *, bool);
+static void write_string(int *, u_int, struct sysctlnode *, char *, bool);
static void display_number(const struct sysctlnode *, const char *,
const void *, size_t, int);
static void display_string(const struct sysctlnode *, const char *,
@@ -898,10 +898,10 @@
case CTLTYPE_INT:
case CTLTYPE_BOOL:
case CTLTYPE_QUAD:
- write_number(&name[0], namelen, node, value);
+ write_number(&name[0], namelen, node, value, optional);
break;
case CTLTYPE_STRING:
- write_string(&name[0], namelen, node, value);
+ write_string(&name[0], namelen, node, value, optional);
break;
case CTLTYPE_STRUCT:
/*
@@ -1697,7 +1697,7 @@
* ********************************************************************
*/
static void
-write_number(int *name, u_int namelen, struct sysctlnode *node, char *value)
+write_number(int *name, u_int namelen, struct sysctlnode *node, char *value,
bool opt)
{
u_int ii, io;
u_quad_t qi, qo;
@@ -1754,7 +1754,8 @@
rc = sysctl(name, namelen, o, &so, i, si);
if (rc == -1) {
- sysctlerror(0);
+ if (!opt)
+ sysctlerror(0);
return;
}
@@ -1775,7 +1776,7 @@
}
static void
-write_string(int *name, u_int namelen, struct sysctlnode *node, char *value)
+write_string(int *name, u_int namelen, struct sysctlnode *node, char *value,
bool opt)
{
char *i, *o;
size_t si, so;
@@ -1796,7 +1797,9 @@
rc = sysctl(name, namelen, o, &so, i, si);
if (rc == -1) {
- sysctlerror(0);
+ if (!opt)
+ sysctlerror(0);
+ free(o);
return;
}
Home |
Main Index |
Thread Index |
Old Index