natFileDescriptorEcos.cc (init): Don't use GetStdHandle.
authorTom Tromey <tromey@redhat.com>
Wed, 6 Mar 2002 23:23:34 +0000 (23:23 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Wed, 6 Mar 2002 23:23:34 +0000 (23:23 +0000)
* java/io/natFileDescriptorEcos.cc (init): Don't use
GetStdHandle.
* java/io/natFileDescriptorPosix.cc (valid): Don't call stat if FD
is negative.
(init): Don't use GetStdHandle.

From-SVN: r50383

libjava/ChangeLog
libjava/java/io/natFileDescriptorEcos.cc
libjava/java/io/natFileDescriptorPosix.cc

index f96bbab..6de0a68 100644 (file)
@@ -1,5 +1,11 @@
 2002-03-06  Tom Tromey  <tromey@redhat.com>
 
+       * java/io/natFileDescriptorEcos.cc (init): Don't use
+       GetStdHandle.
+       * java/io/natFileDescriptorPosix.cc (valid): Don't call stat if FD
+       is negative.
+       (init): Don't use GetStdHandle.
+
        * include/config.h.in: Rebuilt.
        * configure: Rebuilt.
        * Makefile.in: Rebuilt.
index 81e10e2..8e1dd95 100644 (file)
@@ -1,6 +1,6 @@
 // natFileDescriptor.cc - Native part of FileDescriptor class.
 
-/* Copyright (C) 1998, 1999, 2001  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2001, 2002  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -44,9 +44,9 @@ diag_write (char *data, int len)
 void
 java::io::FileDescriptor::init(void)
 {
-  in = new java::io::FileDescriptor((jint)(GetStdHandle (0)));
-  out = new java::io::FileDescriptor((jint)(GetStdHandle (1)));
-  err = new java::io::FileDescriptor((jint)(GetStdHandle (2)));
+  in = new java::io::FileDescriptor(0);
+  out = new java::io::FileDescriptor(1);
+  err = new java::io::FileDescriptor(2);
 }
 
 jboolean
index 83a1261..5352f99 100644 (file)
@@ -1,6 +1,6 @@
 // natFileDescriptor.cc - Native part of FileDescriptor class.
 
-/* Copyright (C) 1998, 1999, 2000, 2001  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -46,18 +46,18 @@ details.  */
 #define NO_FSYNC_MESSAGE "sync unsupported"
 
 void
-java::io::FileDescriptor::init(void)
+java::io::FileDescriptor::init (void)
 {
-  in = new java::io::FileDescriptor((jint)(GetStdHandle (0)));
-  out = new java::io::FileDescriptor((jint)(GetStdHandle (1)));
-  err = new java::io::FileDescriptor((jint)(GetStdHandle (2)));
+  in = new java::io::FileDescriptor(0);
+  out = new java::io::FileDescriptor(1);
+  err = new java::io::FileDescriptor(2);
 }
 
 jboolean
 java::io::FileDescriptor::valid (void)
 {
   struct stat sb;
-  return ::fstat (fd, &sb) == 0;
+  return fd >= 0 && ::fstat (fd, &sb) == 0;
 }
 
 void