Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Apr 2019 20:37:14 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345853 - head/usr.bin/rctl
Message-ID:  <201904032037.x33KbEjq070604@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Wed Apr  3 20:37:14 2019
New Revision: 345853
URL: https://svnweb.freebsd.org/changeset/base/345853

Log:
  rctl: fix sysctl kern.racct.enable use after r341182
  
  The value was changed from int to bool. Since the new type
  is smaller, the rest of the variable in the caller was left
  unitialized.
  
  PR:		236714
  Reported by:	trasz
  Diagnosed by:	markj
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.bin/rctl/rctl.c

Modified: head/usr.bin/rctl/rctl.c
==============================================================================
--- head/usr.bin/rctl/rctl.c	Wed Apr  3 19:59:45 2019	(r345852)
+++ head/usr.bin/rctl/rctl.c	Wed Apr  3 20:37:14 2019	(r345853)
@@ -378,8 +378,9 @@ print_rules(char *rules, int hflag, int nflag)
 static void
 enosys(void)
 {
-	int error, racct_enable;
 	size_t racct_enable_len;
+	int error;
+	bool racct_enable;
 
 	racct_enable_len = sizeof(racct_enable);
 	error = sysctlbyname("kern.racct.enable",
@@ -392,7 +393,7 @@ enosys(void)
 		err(1, "sysctlbyname");
 	}
 
-	if (racct_enable == 0)
+	if (!racct_enable)
 		errx(1, "RACCT/RCTL present, but disabled; enable using kern.racct.enable=1 tunable");
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904032037.x33KbEjq070604>