summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-01-03 07:21:12 +0000
committerRichard M. Stallman <rms@gnu.org>1994-01-03 07:21:12 +0000
commit4f8804a1e59f29007ccf33fd103ef047bdfcd9b1 (patch)
tree24edcc91109800c7e1da7526e94bdd09df56cbf7 /src
parent151c7da2547e48e0400313d7205494193be849d6 (diff)
downloademacs-4f8804a1e59f29007ccf33fd103ef047bdfcd9b1.tar.gz
(get_system_name): If the official name of the host is
not a fully qualified domain name, then try to find one in the list of alternate names.
Diffstat (limited to 'src')
-rw-r--r--src/sysdep.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index 55f4d57da1b..bdac188ed64 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1895,6 +1895,16 @@ get_system_name ()
hp = gethostbyname (system_name_saved);
if (hp && strlen (hp->h_name) < sizeof(system_name_saved))
strcpy (system_name_saved, hp->h_name);
+ if (hp && !index (system_name_saved, '.'))
+ {
+ /* 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++;
+ if (*alias && strlen (*alias) < sizeof (system_name_saved))
+ strcpy (system_name_saved, *alias);
+ }
}
#endif /* HAVE_SOCKETS */
#endif /* not VMS */