summaryrefslogtreecommitdiff
path: root/sbin/sysctl/sysctl.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-08-16 21:39:17 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-08-16 21:39:17 +0000
commit8117d5629e69c3d414ea68ab567e15bb1a9d6e71 (patch)
treee6949d90e8737e3ad9a1912e7cf76968d2d61cc9 /sbin/sysctl/sysctl.c
parentbde310e5c3250419baf37e51315534cd1d649d3c (diff)
repair operation of kern.arandom, which will only allow a buffer of
512 bytes. As a result, it stopped working... ok miod
Diffstat (limited to 'sbin/sysctl/sysctl.c')
-rw-r--r--sbin/sysctl/sysctl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index ad914e2c41e..e7bdcdfc473 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.202 2014/05/07 01:49:36 tedu Exp $ */
+/* $OpenBSD: sysctl.c,v 1.203 2014/08/16 21:39:16 deraadt Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -179,6 +179,7 @@ int Aflag, aflag, nflag, qflag;
#define LONGARRAY 0x00000800
#define KMEMSTATS 0x00001000
#define SENSORS 0x00002000
+#define SMALLBUF 0x00004000
/* prototypes */
void debuginit(void);
@@ -410,6 +411,7 @@ parse(char *string, int flags)
case KERN_HOSTID:
case KERN_ARND:
special |= UNSIGNED;
+ special |= SMALLBUF;
break;
case KERN_CPTIME:
special |= LONGARRAY;
@@ -728,7 +730,7 @@ parse(char *string, int flags)
break;
}
}
- size = SYSCTL_BUFSIZ;
+ size = (special & SMALLBUF) ? 512 : SYSCTL_BUFSIZ;
if (sysctl(mib, len, buf, &size, newval, newsize) == -1) {
if (flags == 0)
return;