summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorThomas Blume <Thomas.Blume@suse.com>2016-02-29 10:19:01 +0100
committerThomas Blume <Thomas.Blume@suse.com>2016-02-29 10:19:01 +0100
commit46e1a2278116e2f5067c35127ccbd8589335f734 (patch)
treef62e1626a38c0ebfc64982e46b1bb8a2632664b7 /src/basic
parent5df2b16d4bf03ac3f3f5cf6f91d5490cab4681d6 (diff)
shorten hostname before checking for trailing dot
Shortening can lead to a hostname that has a trailing dot. Therefore it should be done before checking from trailing dots.
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/hostname-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c
index 3cd2f2c872..5a7ee87a20 100644
--- a/src/basic/hostname-util.c
+++ b/src/basic/hostname-util.c
@@ -150,6 +150,8 @@ char* hostname_cleanup(char *s) {
assert(s);
+ strshorten(s, HOST_NAME_MAX);
+
for (p = s, d = s, dot = true; *p; p++) {
if (*p == '.') {
if (dot)
@@ -169,8 +171,6 @@ char* hostname_cleanup(char *s) {
else
*d = 0;
- strshorten(s, HOST_NAME_MAX);
-
return s;
}