From 605f81a8968b2df8a28cca2cf11db99ab948a2af Mon Sep 17 00:00:00 2001 From: Michal Sekletar Date: Tue, 21 Oct 2014 18:17:54 +0200 Subject: util: introduce sethostname_idempotent Function queries system hostname and applies changes only when necessary. Also, migrate all client of sethostname to sethostname_idempotent while at it. --- src/core/hostname-setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c index 8aa1cff1d3..57baa79275 100644 --- a/src/core/hostname-setup.c +++ b/src/core/hostname-setup.c @@ -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; } -- cgit v1.2.3-54-g00ecf