X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fhostname-setup.c;h=57baa7927504197d881a024ede7304cfad18ad3a;hb=f1f00dbb7f3741b30d4a26b1a8b65ec46ff1fde3;hp=ac508af122a3104c4cad7b049451b2e8e082527d;hpb=a5c32cff1f56afe6f0c6c70d91a88a7a8238b2d7;p=elogind.git diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c index ac508af12..57baa7927 100644 --- a/src/core/hostname-setup.c +++ b/src/core/hostname-setup.c @@ -42,7 +42,7 @@ static int read_and_strip_hostname(const char *path, char **hn) { if (r < 0) return r; - hostname_cleanup(s); + hostname_cleanup(s, false); if (isempty(s)) { free(s); @@ -82,7 +82,7 @@ int hostname_setup(void) { hn = "localhost"; } - if (sethostname(hn, strlen(hn)) < 0) { + if (sethostname_idempotent(hn) < 0) { log_warning("Failed to set hostname to <%s>: %m", hn); return -errno; }