summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-03-15 21:02:39 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-03-15 21:02:39 +0000
commitc7fe1d17a23f05f50f44565df8171243d28ea4dc (patch)
tree589b83e87d7ce048234fdbf3b138473a59b2ac17
parent4fab456581899b539dfa38abbe09ffa5d335281f (diff)
use sysctl_int_lower (old code had the negative bug)
-rw-r--r--sys/ddb/db_usrreq.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/sys/ddb/db_usrreq.c b/sys/ddb/db_usrreq.c
index 5547c77dec1..934ecd3af2c 100644
--- a/sys/ddb/db_usrreq.c
+++ b/sys/ddb/db_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_usrreq.c,v 1.10 2006/03/13 06:23:20 jsg Exp $ */
+/* $OpenBSD: db_usrreq.c,v 1.11 2006/03/15 21:02:38 deraadt Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff. All rights reserved.
@@ -39,8 +39,6 @@ int
ddb_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen, struct proc *p)
{
- int error, ctlval;
-
/* All sysctl names at this level are terminal. */
if (namelen != 1)
return (ENOTDIR);
@@ -56,27 +54,9 @@ ddb_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case DBCTL_MAXLINE:
return sysctl_int(oldp, oldlenp, newp, newlen, &db_max_line);
case DBCTL_PANIC:
- ctlval = db_panic;
- if ((error = sysctl_int(oldp, oldlenp, newp, newlen, &ctlval)) ||
- newp == NULL)
- return (error);
- if (ctlval != 1 && ctlval != 0)
- return (EINVAL);
- if (ctlval > db_panic && securelevel > 1)
- return (EPERM);
- db_panic = ctlval;
- return (0);
+ return sysctl_int_lower(oldp, oldlenp, newp, newlen, &db_panic);
case DBCTL_CONSOLE:
- ctlval = db_console;
- if ((error = sysctl_int(oldp, oldlenp, newp, newlen, &ctlval)) ||
- newp == NULL)
- return (error);
- if (ctlval != 1 && ctlval != 0)
- return (EINVAL);
- if (ctlval > db_console && securelevel > 1)
- return (EPERM);
- db_console = ctlval;
- return (0);
+ return sysctl_int_lower(oldp, oldlenp, newp, newlen, &db_console);
case DBCTL_LOG:
return (sysctl_int(oldp, oldlenp, newp, newlen, &db_log));
default: