This fixes the segfault i had,

when tried to connect bearbox on X86_64SMP and DNS SERVERS IPV6 compatible.
gethostbyname2() works like gethostbyname(), but permits to specify the address 
family (AF_INET) to which the address must belong.
Glibc2 also has reentrant versions gethostbyname_r() and gethostbyname2_r().


--- /cvs/gateway/gwlib/protected.c 2005-02-11 16:35:48.000000000 +0100
+++ /gateway/gwlib/protected.c 2006-02-23 14:00:23.000000000 +0100
@@ -193,7 +193,7 @@
 
     bufflen = 1024;
     *buff = (char*) gw_malloc(bufflen);
-    while ((res=gethostbyname_r(name, &hp,*buff, bufflen, &tmphp, &herr)) == 
ERANGE) {
+    while ((res=gethostbyname2_r(name, AF_INET,&hp,*buff, bufflen, &tmphp, 
&herr)) == ERANGE) {
         /* enlarge the buffer */
        bufflen *= 2;
        *buff = (char*) gw_realloc(*buff, bufflen);


--
Telemaque - NICE - (FR)
Service Technique - Developpement
http://www.telemaque.fr/
[EMAIL PROTECTED]
Tel : +33 4 93 97 71 64 (fax 68)
--- /cvs/gateway/gwlib/protected.c       2005-02-11 16:35:48.000000000 +0100
+++ /gateway/gwlib/protected.c 2006-02-23 14:00:23.000000000 +0100
@@ -193,7 +193,7 @@
 
     bufflen = 1024;
     *buff = (char*) gw_malloc(bufflen);
-    while ((res=gethostbyname_r(name, &hp,*buff, bufflen, &tmphp, &herr)) == 
ERANGE) {
+    while ((res=gethostbyname2_r(name, AF_INET,&hp,*buff, bufflen, &tmphp, 
&herr)) == ERANGE) {
         /* enlarge the buffer */
        bufflen *= 2;
        *buff = (char*) gw_realloc(*buff, bufflen);

Reply via email to