extend sysctl functions to shadow values
Pass to all the sysctl_* functions a hashmap which can be used to optionally save the value written in the sysctl.
This commit is contained in:
@@ -53,14 +53,14 @@ TEST(sysctl_read) {
|
||||
assert_se(sysctl_read_ip_property(AF_INET, "lo", "forwarding", &s));
|
||||
assert_se(STR_IN_SET(s, "0", "1"));
|
||||
|
||||
r = sysctl_write_ip_property(AF_INET, "lo", "forwarding", s);
|
||||
r = sysctl_write_ip_property(AF_INET, "lo", "forwarding", s, NULL);
|
||||
assert_se(r >= 0 || ERRNO_IS_PRIVILEGE(r) || r == -EROFS);
|
||||
s = mfree(s);
|
||||
|
||||
assert_se(sysctl_read_ip_property(AF_INET, NULL, "ip_forward", &s));
|
||||
assert_se(STR_IN_SET(s, "0", "1"));
|
||||
|
||||
r = sysctl_write_ip_property(AF_INET, NULL, "ip_forward", s);
|
||||
r = sysctl_write_ip_property(AF_INET, NULL, "ip_forward", s, NULL);
|
||||
assert_se(r >= 0 || ERRNO_IS_PRIVILEGE(r) || r == -EROFS);
|
||||
s = mfree(s);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user