[Gc] GC patch for DJGPP

Doug Kaufman dkaufman@rahul.net
Sat, 1 Nov 2003 23:03:32 -0800 (PST)


On Sat, 1 Nov 2003, Boehm, Hans wrote:

> Based on your stack trace, it looks like CORD_lf_close_proc is calling abort()
> because fclose() failed.  In this case client_data is not examined at all.
> With your patch you are just failing to close the file descriptor instead,
> thus masking, but not eliminating the problem.
> 
> If you want to track this down, the next step would be to print errno instead
> of just aborting at that point, and to try to determine why the fclose() failed.
> My guess is that this problem is related to some subtle differences in the
> stdio library between djgpp and e.g. glibc.  It probably does not reflect a
> real GC issue, though it may be a real problem with cords on djgpp.

The errno was EACCESS. Adding a call to fflush() seems to fix the
problem. I am not really sure why.
                           Doug

--- cord/cordtest.c.orig	2000-08-07 12:46:36.000000000 -0800
+++ cord/cordtest.c	2003-11-01 22:51:50.000000000 -0800
@@ -116,7 +116,7 @@
 
 void test_extras()
 {
-#   if defined(__OS2__)
+#   if defined(__OS2__) || defined(__DJGPP__)
 #	define FNAME1 "tmp1"
 #	define FNAME2 "tmp2"
 #   elif defined(AMIGA)
@@ -162,6 +162,7 @@
         x = CORD_cat(x,x);
     }
     if ((f = fopen(FNAME2, "w")) == 0) ABORT("2nd open failed");
+    fflush(f);
     if (CORD_put(x,f) == EOF) ABORT("CORD_put failed");
     if (fclose(f) == EOF) ABORT("fclose failed");
     w = CORD_from_file(f2 = fopen(FNAME2, "rb"));

-- 
Doug Kaufman
Internet: dkaufman@rahul.net