From d31f5d1abe9738c8c2e2a3112bd51d69cb47bfb0 Mon Sep 17 00:00:00 2001
From: moore <moore>
Date: Wed, 28 Aug 2002 07:16:38 +0000
Subject: [PATCH] Fix foregin object braindamage noted by Pierre Mai.

---
 code/foreign.lisp | 8 ++++----
 lisp/FreeBSD-os.c | 6 +++---
 lisp/Linux-os.c   | 6 +++---
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/code/foreign.lisp b/code/foreign.lisp
index 0468d22d6..23d00ef6c 100644
--- a/code/foreign.lisp
+++ b/code/foreign.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/foreign.lisp,v 1.41 2002/08/27 22:18:24 moore Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/foreign.lisp,v 1.42 2002/08/28 07:16:36 moore Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -642,9 +642,9 @@ to skip undefined symbols which don't have an address."
 (defun ensure-lisp-table-opened ()
   (unless *global-table*
     ;; Prevent recursive call if dlopen isn't defined
-    (setf *global-table* (int-sap 0))
-    (setf *global-table* (list (dlopen nil rtld-lazy)))
-    (when (zerop (system:sap-int (car *global-table*)))
+    (setf *global-table* (acons (int-sap 0) nil nil))
+    (setf *global-table* (acons (dlopen nil rtld-lazy) nil nil))
+    (when (zerop (system:sap-int (caar *global-table*)))
       (error "Can't open global symbol table: ~S" (dlerror)))))
 
 (defun load-object-file (file)
diff --git a/lisp/FreeBSD-os.c b/lisp/FreeBSD-os.c
index 2d546d721..82c479798 100644
--- a/lisp/FreeBSD-os.c
+++ b/lisp/FreeBSD-os.c
@@ -12,7 +12,7 @@
  * Much hacked by Paul Werkowski
  * GENCGC support by Douglas Crosher, 1996, 1997.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.c,v 1.8 2002/08/27 22:18:30 moore Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.c,v 1.9 2002/08/28 07:16:38 moore Exp $
  *
  */
 
@@ -216,8 +216,8 @@ void *os_dlsym(const char *sym_name, lispobj lib_list)
 	for (lib_list_head = lib_list;
 	     lib_list_head != NIL;
 	     lib_list_head = (CONS(lib_list_head))->cdr) {
-	    struct cons *lib_cons = (CONS(lib_list_head))->car;
-	    struct sap *dlhandle = (CONS(lib_cons))->car;
+	    struct cons *lib_cons = CONS(CONS(lib_list_head)->car);
+	    struct sap *dlhandle = (struct sap *)PTR(lib_cons->car);
 	    void *sym_addr = dlsym((void *)dlhandle->pointer, sym_name);
 
 	    if (sym_addr)
diff --git a/lisp/Linux-os.c b/lisp/Linux-os.c
index 355f1fb4b..6295ee0b8 100644
--- a/lisp/Linux-os.c
+++ b/lisp/Linux-os.c
@@ -15,7 +15,7 @@
  * GENCGC support by Douglas Crosher, 1996, 1997.
  * Alpha support by Julian Dolby, 1999.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.13 2002/08/27 22:18:31 moore Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.14 2002/08/28 07:16:38 moore Exp $
  *
  */
 
@@ -313,8 +313,8 @@ void *os_dlsym(const char *sym_name, lispobj lib_list)
 	for (lib_list_head = lib_list;
 	     lib_list_head != NIL;
 	     lib_list_head = (CONS(lib_list_head))->cdr) {
-	    struct cons *lib_cons = (struct cons *)(CONS(lib_list_head))->car;
-	    struct sap *dlhandle = (struct sap *)(CONS(lib_cons))->car;
+	    struct cons *lib_cons = CONS(CONS(lib_list_head)->car);
+	    struct sap *dlhandle = (struct sap *)PTR(lib_cons->car);
 
 	    sym_addr = dlsym((void *)dlhandle->pointer, sym_name);
 	    if (sym_addr)
-- 
GitLab