diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-12-05 12:27:29 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-12-10 09:56:56 +0100 |
commit | 5fe7a0a7de9027bbae1a20738da613d6591feec8 (patch) | |
tree | a2ead1edd5d16a85fb6b81de4a09a7f0806504cb /src/basic/hostname-util.c | |
parent | d65652f1f21a4b0c59711320f34266c635393c89 (diff) | |
download | systemd-5fe7a0a7de9027bbae1a20738da613d6591feec8.tar.gz |
basic/hostname-util: do truncation last when cleaning up
This allows more of the original name to be used if there are invalid
chars in the beginning.
Diffstat (limited to 'src/basic/hostname-util.c')
-rw-r--r-- | src/basic/hostname-util.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c index 0230821d22..5bfa028b39 100644 --- a/src/basic/hostname-util.c +++ b/src/basic/hostname-util.c @@ -143,9 +143,7 @@ char* hostname_cleanup(char *s) { assert(s); - strshorten(s, HOST_NAME_MAX); - - for (p = s, d = s, dot = hyphen = true; *p; p++) + for (p = s, d = s, dot = hyphen = true; *p && d - s < HOST_NAME_MAX; p++) if (*p == '.') { if (dot || hyphen) continue; |