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.
This commit is contained in:
Thomas Blume 2016-02-29 10:19:01 +01:00
parent 5df2b16d4b
commit 46e1a22781

View file

@ -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;
}