UnixOperatingSystem.st
changeset 7185 0a3ba41f0d31
parent 7175 e3bba0479a52
child 7198 62450598d208
--- a/UnixOperatingSystem.st	Thu Apr 10 13:02:11 2003 +0200
+++ b/UnixOperatingSystem.st	Thu Apr 10 13:03:26 2003 +0200
@@ -9827,7 +9827,7 @@
 
     desc := fd.
     self invalidate.
-
+'close ' errorPrint. desc errorPrintCR.
     ^ OperatingSystem closeFd:desc.
 
     "Modified: 30.9.1997 / 13:06:55 / stefan"
@@ -9836,14 +9836,16 @@
 !UnixOperatingSystem::FileDescriptorHandle methodsFor:'initialization'!
 
 for:aFileDescriptor
-    "create file for a handle"
+    "create a file for a handle"
 
     |oldHandle|
 
     fd := aFileDescriptor.
     oldHandle := OpenFiles at:aFileDescriptor.
-    (oldHandle notNil and:[oldHandle ~~ self]) ifTrue:[
-	oldHandle invalidate.
+    "/ the 0 is possible, if an fd was open when saving a snapshot image,
+    "/ and we come up in the new image with no one referring to it.
+    (oldHandle notNil and:[oldHandle ~~ 0 and:[ oldHandle ~~ self]]) ifTrue:[
+        oldHandle invalidate.
     ].
     self register.
 
@@ -10273,6 +10275,19 @@
 
 !UnixOperatingSystem::FileDescriptorHandle methodsFor:'private accessing'!
 
+fileDescriptor
+    "return the (integer) fileDescriptor"
+
+%{
+    INT handle = (INT)(__externalAddressVal(self));
+
+    if (__isSmallInteger(handle)) {
+        RETURN (handle);
+    }
+%}.
+    ^ nil
+!
+
 setFileDescriptor:anInteger
 
 %{
@@ -12773,7 +12788,7 @@
 !UnixOperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.155 2003-04-07 18:05:54 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.156 2003-04-10 11:03:26 penk Exp $'
 ! !
 
 UnixOperatingSystem initialize!