fix for bug 2528: installation fails with confusing error message
authorJesse Weaver <jesse.weaver@liblime.com>
Mon, 18 Aug 2008 17:37:55 +0000 (12:37 -0500)
committerGalen Charlton <galen.charlton@liblime.com>
Tue, 19 Aug 2008 18:40:25 +0000 (13:40 -0500)
This makes the dns check happen earlier, and fail humanely if there is a problem.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>

rewrite-config.PL

index 69b070a..6167c5e 100644 (file)
@@ -64,7 +64,11 @@ $myhost = hostname();
 $mydomain = $myhost;
 $mydomain =~ s/^.*?\.//;
 # This is set here to rescue systems with broken DNS
-$myip = $ENV{'WEBSERVER_IP'} || inet_ntoa(scalar gethostbyname($myhost||'localhost')) || die "Cannot get our own IP address: DNS fault?";
+if ( !gethostbyname( $myhost || 'localhost' ) ) {
+    die 'Could not get the IP address of ' . ( $myhost || 'localhost' ) . ', DNS fault?';
+}
+
+$myip = $ENV{'WEBSERVER_IP'} || inet_ntoa( scalar gethostbyname( $myhost||'localhost' ) );
 $prefix = $ENV{'INSTALL_BASE'} || "/usr";
 
 # These are our configuration guesses