diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-30 08:31:53 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-03-30 08:31:53 +0000 |
commit | ef5a6dd776ac4bf49f73d33c2c15049c102661c0 (patch) | |
tree | a90832ff6ed62ee440a41d6b8f9aeb5f1591d924 /ext/Socket | |
parent | d89fc664c30eab1bd50f084f75c9996f69a7b7d0 (diff) | |
download | perl-ef5a6dd776ac4bf49f73d33c2c15049c102661c0.tar.gz |
gethostbyname('localhost') is not that portable.
inet_aton('localhost') in IRIX 5.3 returned an undef,
which in turn made pack_sockaddr_in to barf on zero
length in_addr.
p4raw-id: //depot/perl@19084
Diffstat (limited to 'ext/Socket')
-rwxr-xr-x | ext/Socket/Socket.t | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/Socket/Socket.t b/ext/Socket/Socket.t index c06b9e7a84..a5ad2644e0 100755 --- a/ext/Socket/Socket.t +++ b/ext/Socket/Socket.t @@ -26,8 +26,11 @@ if (socket(T,PF_INET,SOCK_STREAM,6)) { print "ok 1\n"; arm(5); - my $host = $^O eq 'MacOS' ? '127.0.0.1' : 'localhost'; - if ($has_echo && connect(T,pack_sockaddr_in(7,inet_aton($host)))){ + my $host = $^O eq 'MacOS' || ($^O eq 'irix' && $Config{osvers} == 5) ? + '127.0.0.1' : 'localhost'; + my $localhost = inet_aton($host); + + if ($has_echo && defined $localhost && connect(T,pack_sockaddr_in(7,$localhost))){ arm(0); print "ok 2\n"; @@ -53,7 +56,9 @@ if (socket(T,PF_INET,SOCK_STREAM,6)) { } else { print "# You're allowed to fail tests 2 and 3 if\n"; - print "# the echo service has been disabled.\n"; + print "# the echo service has been disabled or if your + print "# gethostbyname() cannot resolve your localhost.\n"; + print "# 'Connection refused' indicates disabled echo service.\n"; print "# 'Interrupted system call' indicates a hanging echo service.\n"; print "# Error: $!\n"; print "ok 2 - skipped\n"; |