NeoMutt Startup Hangs
When network condition is bad, calling getdnsdomainname
in init.c blocks NeoMutt startup for a while if getaddrinfo
is used in getdomain.c.
/* now get FQDN. Use configured domain first, DNS next, then uname */
#ifdef DOMAIN
/* we have a compile-time domain name, use that for Hostname */
Hostname = safe_malloc(mutt_strlen(DOMAIN) + mutt_strlen(ShortHostname) + 2);
sprintf(Hostname, "%s.%s", NONULL(ShortHostname), DOMAIN);
#else
if (!(getdnsdomainname(buffer, sizeof(buffer))))
{
Hostname = safe_malloc(mutt_strlen(buffer) + mutt_strlen(ShortHostname) + 2);
sprintf(Hostname, "%s.%s", NONULL(ShortHostname), buffer);
}
else
/*
* DNS failed, use the nodename. Whether or not the nodename had a '.' in
* it, we can use the nodename as the FQDN. On hosts where DNS is not
* being used, e.g. small network that relies on hosts files, a short host
* name is all that is required for SMTP to work correctly. It could be
* wrong, but we've done the best we can, at this point the onus is on the
* user to provide the correct hostname if the nodename won't work in their
* network.
*/
Hostname = safe_strdup(utsname.nodename);
#endif