util: generalize is_localhost() and use it everywhere where applicable

This commit is contained in:
Lennart Poettering
2014-07-02 13:41:31 +02:00
parent 9a00f57a5b
commit fecc80c1ba
5 changed files with 19 additions and 16 deletions
-12
View File
@@ -1928,18 +1928,6 @@ static int link_enter_enslave(Link *link) {
return 0;
}
/* make sure the hostname is not "localhost" */
static bool is_localhost(const char *hostname) {
assert(hostname);
return streq(hostname, "localhost") ||
streq(hostname, "localhost.") ||
endswith(hostname, ".localhost") ||
endswith(hostname, ".localhost.") ||
endswith(hostname, ".localdomain") ||
endswith(hostname, ".localdomain.");
}
static int link_configure(Link *link) {
int r;