do not show hostname in titlebar if it's FQDN of localhost

This commit is contained in:
Luboš Luňák 2011-03-04 16:22:23 +01:00
parent b0c43762e2
commit 13e6ead66e

View file

@ -421,6 +421,13 @@ bool isLocalMachine(const QByteArray& host)
*dot = '\0';
if (host == hostnamebuf)
return true;
} else { // e.g. LibreOffice likes to give FQDN, even if gethostname() doesn't include domain
QByteArray h = hostnamebuf;
if( getdomainname( hostnamebuf, sizeof hostnamebuf ) >= 0 ) {
hostnamebuf[sizeof(hostnamebuf)-1] = 0;
if( host == h + '.' + QByteArray( hostnamebuf ))
return true;
}
}
}
return false;