From 46e1a2278116e2f5067c35127ccbd8589335f734 Mon Sep 17 00:00:00 2001 From: Thomas Blume Date: Mon, 29 Feb 2016 10:19:01 +0100 Subject: 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. --- src/basic/hostname-util.c | 4 ++-- 1 file 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; } -- cgit v1.2.3-54-g00ecf