Re: Small bug in c/unix/socket.c and parallel installation

Robert Ransom <[email protected]> Thu, 31 Dec 2009 02:43:38 -0800
Newsgroups gmane.lisp.scheme.scheme48
Message-ID <[email protected]>
On Thu, 31 Dec 2009 10:15:27 +0100
"Peng Chang \(Charles\)" <[email protected]> wrote:

> Dear Scheme 48 developers,
> 
> In version 1.8 source file c/unix/socket.c, there's explicit use of
> field h_addr of struct hostent, which is a deprecated alias of new
> h_addr_list[0]. This alias is not always provided, and I suggest you
> either replace the 2 occurrences of h_addr to h_addr_list[0] or accept
> the patch I submit in the attachment.

I don't see any attachments on your message, so I'm sending a patch I
created once upon a time to fix this.

In any case, this bug has been fixed in the current development
sources, along with many other bugs; if you plan to use Scheme 48 (or
package it for other users), *please* use the development tree.

Robert Ransom
scheme48-1.8-netdb-h_addr.patch (text/x-patch, 1011 B)
--- scheme48-1.8-orig/c/unix/socket.c	2008-01-13 23:06:41.000000000 -0800
+++ scheme48-1.8/c/unix/socket.c	2008-06-18 05:59:34.000000000 -0700
@@ -349,11 +349,11 @@
       if (handshake->host_addr == NULL)
 	handshake->errno_val = ENOMEM;
       else
 	handshake->errno_val = 0;
       
-      memcpy(handshake->host_addr, host->h_addr, handshake->host_length);
+      memcpy(handshake->host_addr, host->h_addr_list[0], handshake->host_length);
     }
   s48_note_external_event((long) handshake->event_uid);
 }
 
 static s48_value
@@ -380,11 +380,11 @@
       s48_unregister_external_event_uid(handshake->event_uid);
       host = gethostbyname(handshake->host_name);
       free(handshake);
       if (host == NULL)
 	s48_raise_os_error(h_errno);
-      return s48_enter_byte_vector(host->h_addr, host->h_length);
+      return s48_enter_byte_vector(host->h_addr_list[0], host->h_length);
     }
   else
     {
       s48_value sch_event_uid = S48_UNSPECIFIC;
       s48_value sch_handshake = S48_UNSPECIFIC;