aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorJeff Sturm <jeff.sturm@commerceone.com>2000-12-26 00:24:01 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-12-26 00:24:01 +0000
commit83050e0d93035b6d3f426df57e9096243d63800e (patch)
tree8bd48af9f8b2ae3ec0d24d598d43ca4268c57848 /libjava
parent9a1a15c9267d3597df895957d75a2f0485e35137 (diff)
downloadgcc-83050e0d93035b6d3f426df57e9096243d63800e.zip
gcc-83050e0d93035b6d3f426df57e9096243d63800e.tar.gz
gcc-83050e0d93035b6d3f426df57e9096243d63800e.tar.bz2
FileDescriptor.java: Initialize fd to -1.
2000-12-24 Jeff Sturm <jeff.sturm@commerceone.com> * java/io/FileDescriptor.java: Initialize fd to -1. Remove default constructor. From-SVN: r38485
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog5
-rw-r--r--libjava/java/io/FileDescriptor.java13
2 files changed, 11 insertions, 7 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 14caf09..0fbd6b9 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,8 @@
+2000-12-24 Jeff Sturm <jeff.sturm@commerceone.com>
+
+ * java/io/FileDescriptor.java: Initialize fd to -1.
+ Remove default constructor.
+
2000-12-23 Joseph S. Myers <jsm28@cam.ac.uk>
* java/lang/mprec.h: Change C9X reference to refer to C99.
diff --git a/libjava/java/io/FileDescriptor.java b/libjava/java/io/FileDescriptor.java
index 51c6fd6..493f14c 100644
--- a/libjava/java/io/FileDescriptor.java
+++ b/libjava/java/io/FileDescriptor.java
@@ -49,11 +49,6 @@ public final class FileDescriptor
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)
@@ -84,6 +79,10 @@ public final class FileDescriptor
fd = desc;
}
- // System's notion of file descriptor.
- private int fd;
+ // System's notion of file descriptor. It might seem redundant to
+ // initialize this given that it is reassigned in the constructors.
+ // However, this is necessary because if open() throws an exception
+ // we want to make sure this has the value -1. This is the most
+ // efficient way to accomplish that.
+ private int fd = -1;
}