Skip Menu |

This queue is for tickets about the Socket6 CPAN distribution.

Report information
The Basics
Id: 40826
Status: new
Priority: 0/
Queue: Socket6

People
Owner: Nobody in particular
Requestors: blgl [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.04
  • 0.05
  • 0.06
  • 0.07
  • 0.08
  • 0.09
  • 0.10
  • 0.11
  • 0.12
  • 0.13
  • 0.14
  • 0.15
  • 0.16
  • 0.17
  • 0.18
  • 0.19
  • 0.20
  • 0.21
  • 0.22
  • 0.23
Fixed in: (no value)



Subject: gethostbyname2 doesn't return aliases correctly
gethostbyname2 returns a useless string for the aliases. The included patch contains code that generates a useful string by joining the list of aliases with spaces, just like gethostbyname in the core.
Subject: Socket6-gethostbyname2.diff
diff -u -r Socket6-0.23/Socket6.xs Socket6-0.23-patched/Socket6.xs --- Socket6-0.23/Socket6.xs 2008-08-16 16:47:00.000000000 +0000 +++ Socket6-0.23-patched/Socket6.xs 2008-11-10 23:21:27.000000000 +0000 @@ -441,14 +441,21 @@ #ifdef HAVE_GETHOSTBYNAME2 struct hostent *phe; int count, i; + int acount; + SV *aliases; if ((phe = gethostbyname2(host, af)) != NULL) { for (count = 0; phe->h_addr_list[count]; ++count); EXTEND(sp, 4 + count); PUSHs(sv_2mortal(newSVpv((char *) phe->h_name, strlen(phe->h_name)))); - PUSHs(sv_2mortal(newSVpv((char *) phe->h_aliases, - sizeof(char *)))); + aliases=newSVpv("",0); + for (acount=0; phe->h_aliases[acount]; acount++) { + if (acount>0) + sv_catpv(aliases," "); + sv_catpv(aliases,phe->h_aliases[acount]); + } + PUSHs(sv_2mortal(aliases)); PUSHs(sv_2mortal(newSViv((IV) phe->h_addrtype))); PUSHs(sv_2mortal(newSViv((IV) phe->h_length))); for (i = 0; i < count; ++i) {