This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

guile doesn't build on DU4.0


Hi!

DU 4.0 doesn't define RTLD_GLOBAL, so dynl-dl.c failed to compile.  I
couldn't find anything equivalent to it, so I ended up assuming 0 by
default.

But then, guile would crash immediately, with a memory error in
scm_ungetc.  The problem was that DU 4.0's malloc(0) returns NULL.
This was fortunate, because it helped me spot what looks very much
like a serious memory management bug.

The patch follows:

for libguile/ChangeLog
from  Alexandre Oliva  <oliva@dcc.unicamp.br>

	* dynl-dl.c (sysdep_dynl_link): Define RTLD_GLOBAL to 0 if
	it is not previously defined.
	* ports.c (scm_ungetc): Allocate putback_buf with
	SCM_INITIAL_PUTBACK_BUF_SIZE.
        

--- libguile/dynl-dl.c~	Wed Jun 23 13:00:15 1999
+++ libguile/dynl-dl.c	Mon Aug 30 00:02:31 1999
@@ -59,6 +59,10 @@
      int flags;
      const char *subr;
 {
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
     void *handle = dlopen (fname, (DLOPEN_MODE 
 				   | ((flags & DYNL_GLOBAL)? RTLD_GLOBAL : 0)));
     if (NULL == handle)
--- libguile/ports.c~	Wed Aug 25 08:07:55 1999
+++ libguile/ports.c	Sat Sep  4 06:29:21 1999
@@ -866,7 +866,7 @@
     {
       if (pt->putback_buf == NULL)
 	{
-	  pt->putback_buf = (char *) malloc (pt->putback_buf_size);
+	  pt->putback_buf = (char *) malloc (SCM_INITIAL_PUTBACK_BUF_SIZE);
 	  if (pt->putback_buf == NULL)
 	    scm_memory_error ("scm_ungetc");
 	  pt->putback_buf_size = SCM_INITIAL_PUTBACK_BUF_SIZE;

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{dcc.unicamp.br,guarana.{org,com}} aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]