summaryrefslogtreecommitdiff
path: root/src/core/hostname-setup.c
diff options
context:
space:
mode:
authorMichal Sekletar <msekleta@redhat.com>2014-10-21 18:17:54 +0200
committerMichal Sekletar <msekleta@redhat.com>2014-10-27 10:37:46 +0100
commit605f81a8968b2df8a28cca2cf11db99ab948a2af (patch)
tree5f7bc76ca61e8165860510ee181c57ecbfdd3055 /src/core/hostname-setup.c
parentcaa2f4c0c9613b2e02aafa308c8fb092576014a9 (diff)
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.
Diffstat (limited to 'src/core/hostname-setup.c')
-rw-r--r--src/core/hostname-setup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c
index 8aa1cff1d..57baa7927 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;
}