From e4f46e65603ff39956de1c2fa77c7655eaf2723b Mon Sep 17 00:00:00 2001
From: pmai <pmai>
Date: Wed, 26 Jun 2002 20:48:25 +0000
Subject: [PATCH] Corrected a small byte-ordering issue in the new definition
 of connect-to-inet-socket.  Since CL byte operations are defined to work on
 numbers in host order, which might or might not be the same as network order,
 working portably on network ordered numbers requires conditionalization based
 on the backend byte-order.  Hence it is almost always better to work on host
 ordered numbers directly.

---
 code/internet.lisp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/code/internet.lisp b/code/internet.lisp
index fb7db2879..0dab9f603 100644
--- a/code/internet.lisp
+++ b/code/internet.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/internet.lisp,v 1.34 2002/01/26 13:08:12 pw Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/internet.lisp,v 1.35 2002/06/26 20:48:25 pmai Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -285,12 +285,11 @@ struct in_addr {
 	(error "Error connecting socket to [~A:~A]: ~A"
 	       (if (stringp host)
 		   host
-		   (let ((naddr (htonl addr)))
-		     (format nil "~D.~D.~D.~D"
-			     (ldb (byte 8 0) naddr)
-			     (ldb (byte 8 8) naddr)
-			     (ldb (byte 8 16) naddr)
-			     (ldb (byte 8 24) naddr))))
+		   (format nil "~D.~D.~D.~D"
+			   (ldb (byte 8 24) addr)
+			   (ldb (byte 8 16) addr)
+			   (ldb (byte 8 8) addr)
+			   (ldb (byte 8 0) addr)))
 	       port
 	       (unix:get-unix-error-msg)))
       socket)))
-- 
GitLab