[Top][All Lists]
[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;
}
- Re: cvs emacs and (system-name), (continued)
- Re: cvs emacs and (system-name), Chong Yidong, 2007/04/17
- Re: cvs emacs and (system-name), Tom Tromey, 2007/04/17
- Re: cvs emacs and (system-name), Richard Stallman, 2007/04/18
- Re: cvs emacs and (system-name), Glenn Morris, 2007/04/18
- Re: cvs emacs and (system-name), Tom Tromey, 2007/04/18
- Re: cvs emacs and (system-name), Glenn Morris, 2007/04/19
- Re: cvs emacs and (system-name), Stefan Monnier, 2007/04/19
- Re: cvs emacs and (system-name), Tom Tromey, 2007/04/19
- Re: cvs emacs and (system-name), Chong Yidong, 2007/04/19
- Re: cvs emacs and (system-name), Stefan Monnier, 2007/04/19
- Re: cvs emacs and (system-name),
Stefan Monnier <=
- Re: cvs emacs and (system-name), Chong Yidong, 2007/04/19
- Re: cvs emacs and (system-name), Glenn Morris, 2007/04/19
- Re: cvs emacs and (system-name), Richard Stallman, 2007/04/20
- Re: cvs emacs and (system-name), Chong Yidong, 2007/04/20
- Re: cvs emacs and (system-name), Richard Stallman, 2007/04/19
- Re: cvs emacs and (system-name), Glenn Morris, 2007/04/19
- Re: cvs emacs and (system-name), Richard Stallman, 2007/04/19
- Re: cvs emacs and (system-name), Glenn Morris, 2007/04/19