sysctl-util: rework sysctl_write() to wrap write_string_file()
authorLennart Poettering <lennart@poettering.net>
Tue, 14 Sep 2021 21:19:38 +0000 (23:19 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 15 Sep 2021 14:19:45 +0000 (16:19 +0200)
commit13239c86e01b4d96ca08b321ffc01a30905d46ce
treef8fecf4dbbe1b574c0a9171f2bed733d90a2e8ba
parentbe991d7678c35aa037ef79672c0c70781eebed9c
sysctl-util: rework sysctl_write() to wrap write_string_file()

The sysctl_write_ip_property() call already uses write_string_file(), so
let's do so here, too, to make the codepaths more uniform.

While we are at it, let's also validate the passed path a bit, since we
shouldn't allow sysctls with /../ or such in the name. Hence simplify
the path first, and then check if it is normalized, and refuse if not.
src/basic/sysctl-util.c