summaryrefslogtreecommitdiff
path: root/lib/libutil/getmaxpartitions.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2020-10-12 22:08:35 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2020-10-12 22:08:35 +0000
commita575eb26f0ae95d94ff18ee8b482e93c08feb91b (patch)
tree12eda421b3d080a63f6605f44cc731ab0fa3d34e /lib/libutil/getmaxpartitions.c
parentef53b0617ae0009192465f85b3eebc8715d9108d (diff)
make fixed-sized fixed-value mib[] arrays be const
ok guenther tb millert
Diffstat (limited to 'lib/libutil/getmaxpartitions.c')
-rw-r--r--lib/libutil/getmaxpartitions.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libutil/getmaxpartitions.c b/lib/libutil/getmaxpartitions.c
index dd9d2bc6b3b..7a9d7c5fd97 100644
--- a/lib/libutil/getmaxpartitions.c
+++ b/lib/libutil/getmaxpartitions.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getmaxpartitions.c,v 1.10 2019/06/28 13:32:43 deraadt Exp $ */
+/* $OpenBSD: getmaxpartitions.c,v 1.11 2020/10/12 22:08:34 deraadt Exp $ */
/* $NetBSD: getmaxpartitions.c,v 1.1 1996/05/16 07:03:31 thorpej Exp $ */
/*-
@@ -39,11 +39,10 @@
int
getmaxpartitions(void)
{
- int maxpart, mib[2];
+ const int mib[2] = { CTL_KERN, KERN_MAXPARTITIONS };
+ int maxpart;
size_t varlen;
- mib[0] = CTL_KERN;
- mib[1] = KERN_MAXPARTITIONS;
varlen = sizeof(maxpart);
if (sysctl(mib, 2, &maxpart, &varlen, NULL, (size_t)0) == -1)
return (-1);