summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-03-05 20:34:16 +0100
committerLennart Poettering <lennart@poettering.net>2021-03-05 20:38:51 +0100
commit4b30f2e135ee84041bb597edca7225858f4ef4fb (patch)
tree1c238f9d9b25002c81fb46e9bf87d3bf27965569 /src
parentMerge pull request #18852 from yuwata/tree-wide-use-UINT64_MAX (diff)
downloadsystemd-4b30f2e135ee84041bb597edca7225858f4ef4fb.tar.xz
systemd-4b30f2e135ee84041bb597edca7225858f4ef4fb.zip
sysctl-util: use read_full_virtual_file() for reading sysctls
Given these files are part of procfs, let's use the correct API calls for reading them. This changes one occasion of read_one_line_file() to read_full_virtual_file(), which superficially is a different thing, but shouldn't actually be a difference, since sysctls can't be longer than 4K anyway, and the piecemeal logic behind read_one_line_file() cannot work with the special semantics of procfs anyway.
Diffstat (limited to 'src')
-rw-r--r--src/shared/sysctl-util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c
index a835a8bd0a..c96b5cd77f 100644
--- a/src/shared/sysctl-util.c
+++ b/src/shared/sysctl-util.c
@@ -96,14 +96,14 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c
return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER);
}
-int sysctl_read(const char *property, char **content) {
+int sysctl_read(const char *property, char **ret) {
char *p;
assert(property);
- assert(content);
+ assert(ret);
p = strjoina("/proc/sys/", property);
- return read_full_file(p, content, NULL);
+ return read_full_virtual_file(p, ret, NULL);
}
int sysctl_read_ip_property(int af, const char *ifname, const char *property, char **ret) {
@@ -118,7 +118,7 @@ int sysctl_read_ip_property(int af, const char *ifname, const char *property, ch
ifname ? "/conf/" : "", strempty(ifname),
property[0] == '/' ? "" : "/", property);
- r = read_one_line_file(p, &value);
+ r = read_full_virtual_file(p, &value, NULL);
if (r < 0)
return r;