Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 2015 01:22:28 +0000 (UTC)
From:      Marcelo Araujo <araujo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r284251 - head/lib/libugidfw
Message-ID:  <201506110122.t5B1MSJL003818@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: araujo (ports committer)
Date: Thu Jun 11 01:22:27 2015
New Revision: 284251
URL: https://svnweb.freebsd.org/changeset/base/284251

Log:
  Remove unnecessary variable and fix the usage of sysctl(3).
  
  Differential Revision:	D2733
  Reviewed by:		ngie, kib

Modified:
  head/lib/libugidfw/ugidfw.c

Modified: head/lib/libugidfw/ugidfw.c
==============================================================================
--- head/lib/libugidfw/ugidfw.c	Thu Jun 11 00:24:33 2015	(r284250)
+++ head/lib/libugidfw/ugidfw.c	Thu Jun 11 01:22:27 2015	(r284251)
@@ -1232,7 +1232,7 @@ bsde_delete_rule(int rulenum, size_t buf
 	name[len] = rulenum;
 	len++;
 
-	error = sysctl(name, len, NULL, NULL, &rule, 0);
+	error = sysctl(name, len, NULL, NULL, &rule, sizeof(rule));
 	if (error) {
 		len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules",
 		    rulenum, strerror(errno));
@@ -1247,7 +1247,7 @@ bsde_set_rule(int rulenum, struct mac_bs
     char *errstr)
 {
 	int name[10];
-	size_t len, size;
+	size_t len;
 	int error;
 
 	if (bsde_check_version(buflen, errstr) != 0)
@@ -1264,8 +1264,7 @@ bsde_set_rule(int rulenum, struct mac_bs
 	name[len] = rulenum;
 	len++;
 
-	size = sizeof(*rule);
-	error = sysctl(name, len, NULL, NULL, rule, size);
+	error = sysctl(name, len, NULL, NULL, rule, sizeof(*rule));
 	if (error) {
 		len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules",
 		    rulenum, strerror(errno));
@@ -1281,7 +1280,7 @@ bsde_add_rule(int *rulenum, struct mac_b
 {
 	char charstr[BUFSIZ];
 	int name[10];
-	size_t len, size;
+	size_t len;
 	int error, rule_slots;
 
 	if (bsde_check_version(buflen, errstr) != 0)
@@ -1305,8 +1304,7 @@ bsde_add_rule(int *rulenum, struct mac_b
 	name[len] = rule_slots;
 	len++;
 
-	size = sizeof(*rule);
-	error = sysctl(name, len, NULL, NULL, rule, size);
+	error = sysctl(name, len, NULL, NULL, rule, sizeof(*rule));
 	if (error) {
 		len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules",
 		    rule_slots, strerror(errno));



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