changed:
authorStefan Vogel <sv@exept.de>
Fri, 26 Oct 2012 11:55:43 +0200
changeset 14438 a4280b8038c0
parent 14437 3a983b537183
child 14439 49689a5043dc
changed: #open:withMode: #openError #openError: #openError: was broken - fixed it. raise #openError: instead of #openError
ExternalStream.st
--- a/ExternalStream.st	Fri Oct 26 11:53:04 2012 +0200
+++ b/ExternalStream.st	Fri Oct 26 11:55:43 2012 +0200
@@ -2438,20 +2438,7 @@
 
     "{ Pragma: +optSpace }"
 
-    |exClass|
-
-    exClass := (lastErrorNumber == (OperatingSystem errorNumberFor:#ERROR_FILE_NOT_FOUND))
-	ifTrue:[ FileDoesNotExistException ]
-	ifFalse:[ OpenError ].
-
-    ^ exClass newException
-	errorCode:lastErrorNumber;
-	errorString:(' : ' , (OperatingSystem errorTextForNumber:lastErrorNumber));
-	parameter:self;
-	raiseRequest
-
-    "Modified: / 28-01-1998 / 14:37:42 / stefan"
-    "Modified: / 09-09-2011 / 09:16:40 / cg"
+    ^ self openError:lastErrorNumber.
 !
 
 openError:errorNumber
@@ -2461,16 +2448,16 @@
 
     |exClass|
 
-    exClass := (errorNumber == OperatingSystem errorNumberFor:#ERROR_FILE_NOT_FOUND)
-	ifTrue:[ FileDoesNotExistException ]
-	ifFalse:[ OpenError ].
+    exClass := (errorNumber == (OperatingSystem errorNumberFor:#ERROR_FILE_NOT_FOUND))
+        ifTrue:[ FileDoesNotExistException ]
+        ifFalse:[ OpenError ].
 
     ^ exClass newException
-	errorCode:errorNumber;
-	errorString:(' : ' , (OperatingSystem errorTextForNumber:errorNumber));
-	parameter:self;
-	raiseRequest
-	"/ in:thisContext sender
+        errorCode:errorNumber;
+        errorString:(' : ' , (OperatingSystem errorTextForNumber:errorNumber));
+        parameter:self;
+        raiseRequest
+        "/ in:thisContext sender
 
     "Modified: / 09-09-2011 / 07:22:49 / cg"
 !
@@ -4445,36 +4432,36 @@
 # if 1
        f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
 # else
-	__BEGIN_INTERRUPTABLE__
-	do {
-	    f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
-	} while ((f == NULL) && (__threadErrno == EINTR));
-	__END_INTERRUPTABLE__
+        __BEGIN_INTERRUPTABLE__
+        do {
+            f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
+        } while ((f == NULL) && (__threadErrno == EINTR));
+        __END_INTERRUPTABLE__
 # endif
 #else /* UNIX */
-	__BEGIN_INTERRUPTABLE__
-	do {
-	    f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
-	} while ((f == NULL) && (__threadErrno == EINTR));
-	__END_INTERRUPTABLE__
+        __BEGIN_INTERRUPTABLE__
+        do {
+            f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString));
+        } while ((f == NULL) && (__threadErrno == EINTR));
+        __END_INTERRUPTABLE__
 #endif /* UNIX */
-	if (f == NULL) {
-	    __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno);
-	} else {
-	    if (@global(FileOpenTrace) == true) {
-		fprintf(stderr, "fopen %s [ExternalStream] -> %x\n", __stringVal(aPath), f);
-	    }
-	    fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp);
-	    __INST(handleType) = @symbol(filePointer);
-	    ok = true;
-	}
+        if (f == NULL) {
+            __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno);
+        } else {
+            if (@global(FileOpenTrace) == true) {
+                fprintf(stderr, "fopen %s [ExternalStream] -> %x\n", __stringVal(aPath), f);
+            }
+            fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp);
+            __INST(handleType) = @symbol(filePointer);
+            ok = true;
+        }
     }
 %}.
     ok ifFalse:[
-	"
-	 the open failed for some reason ...
-	"
-	^ self openError
+        "
+         the open failed for some reason ...
+        "
+        ^ self openError:lastErrorNumber.
     ].
     position := ZeroPosition.
     Lobby register:self.
@@ -5706,11 +5693,11 @@
 !ExternalStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.349 2012-03-26 17:02:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.350 2012-10-26 09:55:43 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.349 2012-03-26 17:02:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.350 2012-10-26 09:55:43 stefan Exp $'
 ! !
 
 ExternalStream initialize!