From: Thomas Blume Date: Mon, 29 Feb 2016 09:19:01 +0000 (+0100) Subject: shorten hostname before checking for trailing dot X-Git-Tag: v230~302^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2763%2Fhead;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c index 3cd2f2c8721..5a7ee87a20c 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; }