--- a/ExternalStream.st Mon Oct 23 17:50:42 1995 +0100
+++ b/ExternalStream.st Mon Oct 23 17:55:03 1995 +0100
@@ -24,7 +24,7 @@
COPYRIGHT (c) 1988 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.55 1995-09-23 11:16:35 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.56 1995-10-23 16:53:43 cg Exp $
'!
!ExternalStream primitiveDefinitions!
@@ -91,7 +91,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.55 1995-09-23 11:16:35 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.56 1995-10-23 16:53:43 cg Exp $
"
!
@@ -1005,13 +1005,17 @@
* mhmh - since we are interruptable, anObject may move.
* therefore, fetch the cp-pointer within the loop
*/
+ __READING__(f)
__BEGIN_INTERRUPTABLE__
do {
cp = (char *)__InstPtr(anObject) + nInstBytes + offs;
if (_INST(buffered) == false) {
cnt = read(fileno(f), cp, cnt);
} else {
- __READING__(f)
+ if (feof(f)) {
+ cnt = 0;
+ break;
+ }
cnt = fread(cp, 1, cnt, f);
}
} while ((cnt < 0) && (errno == EINTR));
@@ -1895,19 +1899,24 @@
{
__WRITING__(f)
#ifdef LINUX
+ errno = 0;
+
/*
* stdio library has a bug if interrupted
+ * therefore, we go directly into write()
*/
if (_INST(buffered) == false) {
+ int cc, rest;
+
+ cnt = 0;
+ rest = len;
do {
- cnt = write(fileno(f), cp, len);
- if (cnt != len) {
- if (cnt >= 0) {
- if (errno == EINTR) {
- cp += cnt;
- len -= cnt;
- }
- }
+ cc = write(fileno(f), cp, rest);
+ if (cc >= 0) {
+ cp += cc;
+ rest -= cc;
+ cnt += cc;
+ errno = EINTR; /* kludge */
}
} while ((cnt != len) && (errno == EINTR));
} else {
@@ -3234,7 +3243,7 @@
binary ifTrue:[^ self errorBinary].
(mode == #writeonly) ifTrue:[^ self errorWriteOnly].
-%{ /* STACK: 4000 */
+%{ /* STACK: 8000 */
FILE *f;
int done = 0;
REGISTER int c;