[systemd-devel] [PATCH v3] hostname: Allow comments in /etc/hostname

Lennart Poettering lennart at poettering.net
Tue May 19 03:03:59 PDT 2015


On Tue, 19.05.15 07:56, Martin Pitt (martin.pitt at ubuntu.com) wrote:

> Hey Lennart,
> 
> Lennart Poettering [2015-05-18 17:12 +0200]:
> > This code will result in ENOENT being returned on OOM... That's not right...
> 
> Fixed.
> 
> > Also consider using strstrip() here.
> 
> hostname_cleanup() already filters out whitespace, so I don't think
> that's needed?

true!

> > Given that this same code is needed twice in different components,
> > please add a new call read_etc_hostname() to
> > src/shared/hostname-util.c (which I just added to git). It should then
> > also do hostname_cleanup() on the name, and thus pretty much replace
> > read_and_strip_hostname() entirely in hostname-setup.c.
> 
> Done. However, I called the function read_hostname_config() and give
> it a path argument. This is mostly so that we can write tests for it,
> but maybe one of these days we actually want to use it for other
> purposes (reading hostnames from container root fs).

Thanks! Applied!

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list