Patch: java/io/FileDescriptor.java

jeff.sturm@appnet.com jeff.sturm@appnet.com
Sun Dec 24 19:57:00 GMT 2000


This fixes a bug in which uninitialized FileDescriptor objects
accidentally close stdin when finalized.  (This occurs when attempting to
open a nonexistent file, for instance.)

2000-12-24  Jeff Sturm  <jeff.sturm@commerceone.com>

	* java/io/FileDescriptor.java: Initialize fd to -1.
	Remove default constructor.

Index: java/io/FileDescriptor.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/FileDescriptor.java,v
retrieving revision 1.5
diff -u -r1.5 FileDescriptor.java
--- FileDescriptor.java	2000/03/07 19:55:26	1.5
+++ FileDescriptor.java	2000/12/25 03:52:44
@@ -49,11 +49,6 @@
     fd = open (path, mode);
   }
 
-  public FileDescriptor ()
-  {
-    fd = -1;
-  }
-
   native int open (String path, int mode) throws FileNotFoundException;
   native void write (int b) throws IOException;
   native void write (byte[] b, int offset, int len)
@@ -85,5 +80,5 @@
   }
 
   // System's notion of file descriptor.
-  private int fd;
+  private int fd = -1;
 }



More information about the Java-patches mailing list