When exporting variable DISPLAY, if hostname is not the full name, try

to get the full name from DNS.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@91 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Björn Groenvall
1995-09-02 12:37:19 +00:00
parent 6229ce26fd
commit 8c16134cf3

View File

@@ -1717,6 +1717,15 @@ env_init()
gethostname(hbuf, 256);
hbuf[256] = '\0';
/* If this is not the full name, try to get it via DNS */
if (strchr(hbuf, '.') == 0) {
struct hostent *he = gethostbyname(hbuf);
if (he != 0)
strncpy(hbuf, he->h_name, 256);
hbuf[256] = '\0';
}
cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1);
sprintf((char *)cp, "%s%s", hbuf, cp2);
free(ep->value);