[kaffe] File order bug - Testcase

Ito Kazumitsu kaz at maczuka.gcd.org
Wed Aug 10 01:40:15 PDT 2005


From: Wolfgang Baer <WBaer at gmx.de>
Subject: Re: [kaffe] File order bug - Testcase
Date: Wed, 10 Aug 2005 09:31:57 +0200

> yes the API does not specify an order. However, as the unit testcases
> of logkit show, some programs depend on the SUN behaviour.
> 
> This is why I found this "bug" and I think kaffe should follow what Sun
> does (and the other gnu classpath vms).

OK, how about this?

--- libraries/clib/io/File.c.orig	Sun Dec 26 14:52:34 2004
+++ libraries/clib/io/File.c	Wed Aug 10 17:40:36 2005
@@ -207,6 +207,7 @@
   };
   struct dentry* dirlist;
   struct dentry* mentry;
+  struct dentry* lastentry;
   HArrayOfObject* array;
   int count;
   int i;
@@ -221,6 +222,7 @@
   }
   
   dirlist = NULL;
+  lastentry = NULL;
   count = 0;
   /* XXX make part of jsyscall interface !? */
   while ((entry = readdir(dir)) != NULL) {
@@ -242,8 +244,14 @@
       throwError(&info);
     }
     strcpy(mentry->name, entry->d_name);
-    mentry->next = dirlist;
-    dirlist = mentry;
+    mentry->next = NULL;
+    if (count == 0) {
+        dirlist = mentry;
+    }
+    else {
+        lastentry->next = mentry;
+    }
+    lastentry = mentry;
     count++;
   }
   /* XXX make part of jsyscall interface !? */



More information about the kaffe mailing list