Permalink
Browse files

fix for bug 2528: installation fails with confusing error message

This makes the dns check happen earlier, and fail humanely if there is a problem.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
  • Loading branch information...
1 parent 6e53a31 commit 47127455271affc577e6e789d7a1cee13b5b94d1 Jesse Weaver committed with Galen Charlton Aug 18, 2008
Showing with 5 additions and 1 deletion.
  1. +5 −1 rewrite-config.PL
View
@@ -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

0 comments on commit 4712745

Please sign in to comment.