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

Martin Pitt martin.pitt at ubuntu.com
Mon May 18 22:56:20 PDT 2015

Hey Lennart,

Lennart Poettering [2015-05-18 17:12 +0200]:
> This code will result in ENOENT being returned on OOM... That's not right...


> Also consider using strstrip() here.

hostname_cleanup() already filters out whitespace, so I don't think
that's needed?

> 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).

Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-hostname-Allow-comments-in-etc-hostname.patch
Type: text/x-diff
Size: 7715 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150519/d2a32b81/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150519/d2a32b81/attachment.sig>

More information about the systemd-devel mailing list