Remove unnecessary variable and fix the usage of sysctl(3).

Differential Revision:	D2733
Reviewed by:		ngie, kib
This commit is contained in:
Marcelo Araujo 2015-06-11 01:22:27 +00:00
parent c06d629a24
commit a7c4e991b8

View File

@ -1232,7 +1232,7 @@ bsde_delete_rule(int rulenum, size_t buflen, char *errstr)
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_bsdextended_rule *rule, size_t buflen,
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_bsdextended_rule *rule, size_t buflen,
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_bsdextended_rule *rule, size_t buflen,
{
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_bsdextended_rule *rule, size_t buflen,
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));