diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-06-09 08:21:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-09 08:21:57 +0200 |
commit | 377157e6bd743af8de1e89b6109282de4fc5a066 (patch) | |
tree | 956cb80f189728444cadff330466cea0983daa76 /src/core/dbus-cgroup.c | |
parent | hwdb: Add HP Dev One (diff) | |
parent | various: use CONST_MAX for array allocation (diff) | |
download | systemd-377157e6bd743af8de1e89b6109282de4fc5a066.tar.xz systemd-377157e6bd743af8de1e89b6109282de4fc5a066.zip |
Merge pull request #23616 from keszybz/in-addr-to-string-formatting
Add macros that allocate a fixed buffer for in_addr_to_string(), in_addr_prefix+to_string()
Diffstat (limited to 'src/core/dbus-cgroup.c')
-rw-r--r-- | src/core/dbus-cgroup.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c index 6070c21c4c..82072da9e4 100644 --- a/src/core/dbus-cgroup.c +++ b/src/core/dbus-cgroup.c @@ -1849,25 +1849,16 @@ int bus_cgroup_set_property( fputs(name, f); fputs("=\n", f); } else { - struct in_addr_prefix *p; - *reduced = false; r = in_addr_prefixes_merge(prefixes, new_prefixes); if (r < 0) return r; - SET_FOREACH(p, new_prefixes) { - _cleanup_free_ char *buffer = NULL; - - r = in_addr_prefix_to_string(p->family, &p->address, p->prefixlen, &buffer); - if (r == -ENOMEM) - return r; - if (r < 0) - continue; - - fprintf(f, "%s=%s\n", name, buffer); - } + const struct in_addr_prefix *p; + SET_FOREACH(p, new_prefixes) + fprintf(f, "%s=%s\n", name, + IN_ADDR_PREFIX_TO_STRING(p->family, &p->address, p->prefixlen)); } r = fflush_and_check(f); |