summaryrefslogtreecommitdiff
path: root/src/hostname
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/hostname
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/hostname')
-rw-r--r--src/hostname/hostnamed.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 0cffb5f68..a449610bb 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -287,7 +287,7 @@ static int context_update_kernel_hostname(Context *c) {
else
hn = "localhost";
- if (sethostname(hn, strlen(hn)) < 0)
+ if (sethostname_idempotent(hn) < 0)
return -errno;
return 0;