From a575eb26f0ae95d94ff18ee8b482e93c08feb91b Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Mon, 12 Oct 2020 22:08:35 +0000 Subject: make fixed-sized fixed-value mib[] arrays be const ok guenther tb millert --- lib/libutil/getmaxpartitions.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/libutil/getmaxpartitions.c') 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); -- cgit v1.2.3