[kaffe] CVS kaffe (guilhem): Fix for infinite loop when readByte encounters the EOF.

Kaffe CVS cvs-commits at kaffe.org
Tue Sep 2 10:56:02 PDT 2003


PatchSet 4013 
Date: 2003/09/02 17:53:08
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fix for infinite loop when readByte encounters the EOF.

Members: 
	ChangeLog:1.1609->1.1610 
	libraries/clib/io/FileDescriptor.c:1.6->1.7 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1609 kaffe/ChangeLog:1.1610
--- kaffe/ChangeLog:1.1609	Tue Sep  2 16:40:56 2003
+++ kaffe/ChangeLog	Tue Sep  2 17:53:08 2003
@@ -1,3 +1,9 @@
+2003-09-02  Guilhem Lavaux <guilhem at kaffe.org>
+
+	* libraries/clib/io/FileDescriptor.c:
+	(java_io_FileDescriptor_nativeReadByte) check for EOF (rc == 0 && ret
+	== 0).
+
 2003-09-02  Timothy S. Stack <stack at cs.utah.edu>
 
 	* kaffe/kaffevm/intrp/icode.h,
Index: kaffe/libraries/clib/io/FileDescriptor.c
diff -u kaffe/libraries/clib/io/FileDescriptor.c:1.6 kaffe/libraries/clib/io/FileDescriptor.c:1.7
--- kaffe/libraries/clib/io/FileDescriptor.c:1.6	Sun Aug 31 17:16:49 2003
+++ kaffe/libraries/clib/io/FileDescriptor.c	Tue Sep  2 17:53:09 2003
@@ -101,7 +101,6 @@
     break;
   default:
     SignalError("java.io.FileNotFoundException", SYS_ERROR(rc));
-    return -1;
   }
   return fd;
 }
@@ -114,7 +113,6 @@
   if (rc != 0)
     {
       SignalError("java.io.IOException", SYS_ERROR(rc));
-      return -1;
     }
   return 0;
 }
@@ -133,7 +131,6 @@
     if (rc != 0 && rc != EINTR)
     {
       SignalError("java.io.IOException", SYS_ERROR(rc));
-      return -1;
     }
   }
   while (rc != 0);
@@ -156,7 +153,6 @@
     if (rc != 0 && rc != EINTR)
     {
       SignalError("java.io.IOException", SYS_ERROR(rc));
-      return -1;
     }
     nativeWritten += ret;
   }
@@ -175,10 +171,11 @@
   do
   {
     rc = KREAD(nativeFd, &native_data, 1, &ret);
+    if (rc == 0 && ret == 0)
+      return -1;
     if (rc != 0 && rc != EINTR)
     {
       SignalError("java.io.IOException", SYS_ERROR(rc));
-      return -1;
     }
   }
   while (ret != 1);
@@ -209,7 +206,6 @@
     if (rc != 0 && rc != EINTR)
     {
       SignalError("java.io.IOException", SYS_ERROR(rc));
-      return -1;
     }
     nativeRead += ret;
   }




More information about the kaffe mailing list