--- tools.c.old	Tue Oct 17 13:01:49 2000
+++ tools.c	Tue Oct 17 13:05:05 2000
@@ -432,60 +432,63 @@
     if (Config.visibleHostname != NULL)
 	return Config.visibleHostname;
     if (present)
 	return host;
     host[0] = '\0';
     if (Config.Sockaddr.http->s.sin_addr.s_addr != any_addr.s_addr) {
 	/*
 	 * If the first http_port address has a specific address, try a
 	 * reverse DNS lookup on it.
 	 */
 	h = gethostbyaddr((char *) &Config.Sockaddr.http->s.sin_addr,
 	    sizeof(Config.Sockaddr.http->s.sin_addr), AF_INET);
 	if (h != NULL) {
 	    /* DNS lookup successful */
 	    /* use the official name from DNS lookup */
 	    xstrncpy(host, h->h_name, SQUIDHOSTNAMELEN);
 	    debug(50, 4) ("getMyHostname: resolved %s to '%s'\n",
 		inet_ntoa(Config.Sockaddr.http->s.sin_addr),
 		host);
 	    present = 1;
-	    return host;
+            if( strchr( host, '.' ) )
+                return host;
+
 	}
-	debug(50, 1) ("WARNING: failed to resolve %s to a hostname\n",
+        debug(50, 1) ("WARNING: failed to resolve %s to a fully qualified hostname\n",
 	    inet_ntoa(Config.Sockaddr.http->s.sin_addr));
     }
     /*
      * Get the host name and store it in host to return
      */
     if (gethostname(host, SQUIDHOSTNAMELEN) < 0) {
 	debug(50, 1) ("WARNING: gethostname failed: %s\n", xstrerror());
     } else if ((h = gethostbyname(host)) == NULL) {
 	debug(50, 1) ("WARNING: gethostbyname failed for %s\n", host);
     } else {
 	debug(50, 6) ("getMyHostname: '%s' resolved into '%s'\n",
 	    host, h->h_name);
 	/* DNS lookup successful */
 	/* use the official name from DNS lookup */
 	xstrncpy(host, h->h_name, SQUIDHOSTNAMELEN);
 	present = 1;
-	return host;
+        if( strchr( host, '.' ) )
+            return host;
     }
     fatal("Could not determine fully qualified hostname.  Please set 'visible_hostname'\n");
     return NULL;		/* keep compiler happy */
 }
 
 const char *
 uniqueHostname(void)
 {
     return Config.uniqueHostname ? Config.uniqueHostname : getMyHostname();
 }
 
 void
 safeunlink(const char *s, int quiet)
 {
     statCounter.syscalls.disk.unlinks++;
     if (unlink(s) < 0 && !quiet)
 	debug(50, 1) ("safeunlink: Couldn't delete %s: %s\n", s, xstrerror());
 }
 
 /* leave a privilegied section. (Give up any privilegies)

