f35cb39ed6
First of all, let's rename it to read_etc_hostname(), to make clearer what kind of configuration it actually reads: the file format defined in /etc/hostname and nothing else. Secondly: let's port this to use read_line(), i.e. the new way to read lines from a file in a safe, bounded way. Thirdly: let's strip leading/trailing whitespace from what we are reading. Given that we are already pretty lenient what we read (comments and empty lines), let's be permissive regarding whitespace too. Fourthly: let's actually validate the hostname when reading it. So far we tried to make it valid, but that's not always possible (for example, we can't make an empty hostname valid, ever). |
||
---|---|---|
.. | ||
hostnamectl.c | ||
hostnamed.c | ||
meson.build | ||
org.freedesktop.hostname1.conf | ||
org.freedesktop.hostname1.policy.in | ||
org.freedesktop.hostname1.service |