emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cvs emacs and (system-name)


From: Stefan Monnier
Subject: Re: cvs emacs and (system-name)
Date: Thu, 19 Apr 2007 17:23:30 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.94 (gnu/linux)

> !             while (*alias && ( !index (*alias, '.') ||
> !                  !strcmp (*alias, "localhost.localdomain" ) ) )

How 'bout the patch below instead.


        Stefan


PS: Now that I think about it, maybe a better approach is to look for
    an alias that not only has a "." but additionally has the hostname
    as prefix.  This is what my second patch does.  Both patches are
    guaranteed 100% untested.


--- orig/src/sysdep.c
+++ mod/src/sysdep.c
@@ -2428,7 +2428,13 @@
            char *p;
 #endif
 
-           if (!index (fqdn, '.'))
+           if (!index (fqdn, '.')
+               /* If the IP address is 127.*.*.*, don't bother looking for
+                  a fqdn in the aliases since the name itself won't matter
+                  much and we may end up with localhost.localdomain
+                  or some other meaningless "fqdn".  */
+               && !(hp->h_addrtype == AF_INET
+                    && hp->h_addr[0] == 127))
              {
                /* We still don't have a fully qualified domain name.
                   Try to find one in the list of alternate names */



--- orig/src/sysdep.c
+++ mod/src/sysdep.c
@@ -2428,8 +2428,16 @@
                /* We still don't have a fully qualified domain name.
                   Try to find one in the list of alternate names */
                char **alias = hp->h_aliases;
-               while (*alias && !index (*alias, '.'))
-                 alias++;
+               while (*alias)
+                 {
+                   char *i = index (*alias, '.');
+                   /* hp->h_name is supposed to be the "official name" so we
+                      should not take any random fully qualified alias.  */
+                   if (i && strlen (fqdn) == i - *alias
+                       && !strncmp (fqdn, *alias, i - *alias))
+                     break;
+                   alias++;
+                 }
                if (*alias)
                  fqdn = *alias;
              }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]