summaryrefslogtreecommitdiff
path: root/ext/IO
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-09-09 13:03:33 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-09-09 13:03:33 +0000
commit7822251ecf4a18e47928777b0f052ad10c2a4a33 (patch)
treea914caacaf14d74ebf989d8b9e18c1996bc794bd /ext/IO
parent727f22e3bfa8ab582ce8ac7dc421247d52c9d694 (diff)
downloadperl-7822251ecf4a18e47928777b0f052ad10c2a4a33.tar.gz
Try to look up protocol (by name) only iff it has non-numbers:
nice if the server is in a chrooted environment (no /etc/protocols, server code using hardcorded protocol numbers like 6 for tcp), suggested by John Holdsworth <coldwave@bigfoot.com>. In other words, if we are given a number, why look it up again (by number)? p4raw-id: //depot/perl@11957
Diffstat (limited to 'ext/IO')
-rw-r--r--ext/IO/lib/IO/Socket/INET.pm7
1 files changed, 2 insertions, 5 deletions
diff --git a/ext/IO/lib/IO/Socket/INET.pm b/ext/IO/lib/IO/Socket/INET.pm
index b36a65b951..8f1845b248 100644
--- a/ext/IO/lib/IO/Socket/INET.pm
+++ b/ext/IO/lib/IO/Socket/INET.pm
@@ -41,11 +41,8 @@ sub _sock_info {
$port = $1
if(defined $addr && $addr =~ s,:([\w\(\)/]+)$,,);
- if(defined $proto) {
- if (@proto = ( $proto =~ m,\D,
- ? getprotobyname($proto)
- : getprotobynumber($proto))
- ) {
+ if(defined $proto && $proto =~ /\D/) {
+ if(@proto = getprotobyname($proto) {
$proto = $proto[2] || undef;
}
else {