From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Glenn Morris <rgm@gnu.org>
Cc: tromey@redhat.com, schwab@suse.de, cyd@stupidchicken.com,
rms@gnu.org, emacs-devel@gnu.org
Subject: Re: cvs emacs and (system-name)
Date: Thu, 19 Apr 2007 17:23:30 -0400 [thread overview]
Message-ID: <jwvps60t8s2.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <5qejmhhsbo.fsf@fencepost.gnu.org> (Glenn Morris's message of "Thu\, 19 Apr 2007 01\:00\:11 -0400")
> ! 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;
}
next prev parent reply other threads:[~2007-04-19 21:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-17 18:31 cvs emacs and (system-name) Tom Tromey
2007-04-17 19:05 ` Andreas Schwab
2007-04-17 18:50 ` Tom Tromey
2007-04-17 19:45 ` Chong Yidong
2007-04-17 19:30 ` Tom Tromey
2007-04-18 14:55 ` Richard Stallman
2007-04-18 17:17 ` Glenn Morris
2007-04-18 21:40 ` Tom Tromey
2007-04-19 5:00 ` Glenn Morris
2007-04-19 16:14 ` Stefan Monnier
2007-04-19 18:25 ` Tom Tromey
2007-04-19 18:48 ` Chong Yidong
2007-04-19 21:25 ` Stefan Monnier
2007-04-19 21:23 ` Stefan Monnier [this message]
2007-04-19 21:30 ` Chong Yidong
2007-04-19 21:31 ` Glenn Morris
2007-04-20 14:52 ` Richard Stallman
2007-04-20 21:39 ` Chong Yidong
2007-04-19 23:17 ` Richard Stallman
2007-04-20 1:27 ` Glenn Morris
2007-04-19 13:42 ` Richard Stallman
2007-04-19 17:05 ` Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvps60t8s2.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=cyd@stupidchicken.com \
--cc=emacs-devel@gnu.org \
--cc=rgm@gnu.org \
--cc=rms@gnu.org \
--cc=schwab@suse.de \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.