OSDN Git Service

2001-04-18 Jeff Johnston <jjohnstn@redhat.com>
authorjjohnstn <jjohnstn>
Wed, 18 Apr 2001 19:50:00 +0000 (19:50 +0000)
committerjjohnstn <jjohnstn>
Wed, 18 Apr 2001 19:50:00 +0000 (19:50 +0000)
        * gloss.cxx (gloss32::reset): Move check for std streams into
        hostops::close.
        * hostops.cxx (hostops::close): Don't close host std streams.

sid/component/gloss/ChangeLog
sid/component/gloss/gloss.cxx
sid/component/gloss/hostops.cxx

index 93786da..7ddd944 100644 (file)
@@ -1,3 +1,9 @@
+2001-04-18  Jeff Johnston  <jjohnstn@redhat.com>
+
+        * gloss.cxx (gloss32::reset): Move check for std streams into
+        hostops::close.
+        * hostops.cxx (hostops::close): Don't close host std streams.
+
 2001-01-26  Nicholas Duffek  <nsd@redhat.com>
 
        * gloss.cxx (gloss32::do_sys_exit): Pass exit value in bits 8..15
index 3215618..a633ff3 100644 (file)
@@ -95,9 +95,8 @@ gloss32::reset()
       for (int i = 0; i < max_fds; ++i)
        {
          int errcode;
-         if (fd_table[i] > 2)
-           if (! host_ops->close (fd_table[i], errcode))
-             cerr << "*** While resetting, close("
+         if (! host_ops->close (fd_table[i], errcode))
+           cerr << "*** While resetting, close("
                   << fd_table[i]
                   << ") unexpectedly failed." << endl;
        }
index 20693f1..917ade0 100644 (file)
@@ -94,10 +94,14 @@ hostops::open (const char* filename, int flags, int mode, int& result_fd, int& e
 bool
 hostops::close (int fd, int& errcode)
 {
-  if (::close (fd) < 0)
-    {
-      errcode = errno;
-      return false;
+  /* don't close the host's stdin, stdout, and stderr */
+  if (fd > 2)
+    {  
+      if (::close (fd) < 0)
+        {
+          errcode = errno;
+          return false;
+        }
     }
   return true;
 }