ExternalStream.st
changeset 849 033900f9b217
parent 826 b271ea453f6a
child 872 af04035b443d
--- a/ExternalStream.st	Thu Jan 11 14:51:39 1996 +0100
+++ b/ExternalStream.st	Thu Jan 11 21:37:35 1996 +0100
@@ -3317,6 +3317,30 @@
 		int cc, rest;
 
 		cnt = 0;
+#ifdef LINUX
+		rest = len;
+		do {
+                    /*
+                     * in linux, partial writes seem to be possible
+                     * with ttys when interrupted ...
+		     * I do not like this
+                     */
+		    do {
+		        cp = __ByteArrayInstPtr(aCollection)->ba_element + offs;
+                        cc = write(fileno(f), cp, rest);
+			if (cc > 0) {
+			    cnt += cc;
+			    offs += cc;
+			    rest -= cc;
+			} else {
+			    if (cc < 0) {
+				cnt = cc;
+			    }
+			}
+		    } while ((cc >= 0) && rest);
+		} while ((cnt < 0) && (errno == EINTR));
+
+#else
 		do {
 		    /*
 		     * refetch pointer in case of an interrupt
@@ -3324,6 +3348,7 @@
 		    cp = __ByteArrayInstPtr(aCollection)->ba_element + offs;
 		    cnt = write(fileno(f), cp, len);
 		} while ((cnt < 0) && (errno == EINTR));
+#endif
 	    } else {
 		__WRITING__(f)
 		cnt = fwrite(cp, 1, len, f);
@@ -3455,6 +3480,6 @@
 !ExternalStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.82 1996-01-03 23:25:58 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.83 1996-01-11 20:37:35 cg Exp $'
 ! !
 ExternalStream initialize!