mirror of
https://github.com/systemd/systemd.git
synced 2025-02-10 17:57:40 +03:00
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:
parent
5df2b16d4b
commit
46e1a22781
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user