aboutsummaryrefslogtreecommitdiff
path: root/lib/libutil
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2005-10-05 04:42:20 +0000
committerBrooks Davis <brooks@FreeBSD.org>2005-10-05 04:42:20 +0000
commit72bd741cfc073c745bc3b9faf041d0578dfd6050 (patch)
treebf5ab786c2786f9f67d2d43317789dc0255a8fda /lib/libutil
parent07f5921b8651c8a57b23b488ae79a739257d8dea (diff)
Notes
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/trimdomain.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/libutil/trimdomain.c b/lib/libutil/trimdomain.c
index a7ce8c4eaea35..85c27e0a1c10c 100644
--- a/lib/libutil/trimdomain.c
+++ b/lib/libutil/trimdomain.c
@@ -75,18 +75,16 @@ trimdomain(char *fullhost, int hostsize)
s = fullhost;
end = s + hostsize + 1;
- for (; (s = memchr(s, '.', (size_t)(end - s))) != NULL; s++) {
+ if ((s = memchr(s, '.', (size_t)(end - s))) != NULL) {
if (strncasecmp(s + 1, domain, dlen) == 0) {
if (s[dlen + 1] == '\0') {
/* Found -- lose the domain. */
*s = '\0';
- break;
} else if (s[dlen + 1] == ':' &&
isDISP(s + dlen + 2) &&
(len = strlen(s + dlen + 1)) < (size_t)(end - s)) {
/* Found -- shuffle the DISPLAY back. */
memmove(s, s + dlen + 1, len + 1);
- break;
}
}
}