diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2011-02-08 18:36:40 +0000 |
---|---|---|
committer | H.Merijn Brand <h.m.brand@xs4all.nl> | 2011-02-08 21:24:41 +0100 |
commit | 0cd14f2ec7a4a1ffa38fa241b15618478fce8cf3 (patch) | |
tree | b95c989fd09ee41884f194ccd4d015195931469e /ext/Socket | |
parent | 46d4dcbda33f17cc3dd58db4c256e3af360de90f (diff) | |
download | perl-0cd14f2ec7a4a1ffa38fa241b15618478fce8cf3.tar.gz |
Minor bugfixes to Socket::getaddrinfo
Attached are two small bugfixes to getaddrinfo()
Please apply,
Thanks.
--
Paul "LeoNerd" Evans
leonerd@leonerd.org.uk
ICQ# 4135350 | Registered Linux# 179460
http://www.leonerd.org.uk/
From 61fdece8ab9a729206f2633f47e25afd6f05af6a Mon Sep 17 00:00:00 2001
From: Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
Date: Mon, 24 Jan 2011 18:58:40 +0000
Subject: [PATCH 2/3] canonname should only be present on the first returned result
Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
Diffstat (limited to 'ext/Socket')
-rw-r--r-- | ext/Socket/Socket.pm | 10 | ||||
-rw-r--r-- | ext/Socket/Socket.xs | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/ext/Socket/Socket.pm b/ext/Socket/Socket.pm index 509eb2687c..252bb0070f 100644 --- a/ext/Socket/Socket.pm +++ b/ext/Socket/Socket.pm @@ -282,7 +282,8 @@ The address in a packed string (such as would be returned by pack_sockaddr_in) =item canonname => STRING The canonical name for the host if the C<AI_CANONNAME> flag was provided, or -C<undef> otherwise. +C<undef> otherwise. This field will only be present on the first returned +address. =back @@ -736,11 +737,16 @@ sub fake_getaddrinfo socktype => $socktype, protocol => $protocol, addr => Socket::pack_sockaddr_in( $port, $addr ), - canonname => $canonname, + canonname => undef, }; } } + # Only supply canonname for the first result + if( defined $canonname ) { + $ret[0]->{canonname} = $canonname; + } + return ( fake_makeerr( 0 ), @ret ); } diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs index 0dda808945..e9a8c56cc8 100644 --- a/ext/Socket/Socket.xs +++ b/ext/Socket/Socket.xs @@ -292,6 +292,7 @@ static void xs_getaddrinfo(pTHX_ CV *cv) } Zero(&hints_s, sizeof hints_s, char); + hints_s.ai_family = PF_UNSPEC; if(hints && SvOK(hints)) { HV *hintshash; |