summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-10-18 01:01:15 (GMT)
committerhobbs <hobbs>2001-10-18 01:01:15 (GMT)
commitdee0471914bb2b9d7bba088679f1259dd34b8ff1 (patch)
tree481d91fa58c4a364e33f3a5ca623ce9ce8062bdc
parent754c5551ab0ea8485018a184c08caddee84d5d2a (diff)
downloadtcl-dee0471914bb2b9d7bba088679f1259dd34b8ff1.zip
tcl-dee0471914bb2b9d7bba088679f1259dd34b8ff1.tar.gz
tcl-dee0471914bb2b9d7bba088679f1259dd34b8ff1.tar.bz2
* unix/tclUnixPipe.c (PipeInputProc, PipeOutputProc): do immediate
retry when error is returned with errno == EINTR. [Bug #415131] (leger)
-rw-r--r--ChangeLog6
-rw-r--r--unix/tclUnixPipe.c38
2 files changed, 33 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index d1537ad..41264e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-10-17 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tclUnixPipe.c (PipeInputProc, PipeOutputProc): do immediate
+ retry when error is returned with errno == EINTR.
+ [Bug #415131] (leger)
+
2001-10-16 Jeff Hobbs <jeffh@ActiveState.com>
* unix/tclLoadAout.c (TclGuessPackageName): removed unused vars
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c
index 85316c0..82f180e 100644
--- a/unix/tclUnixPipe.c
+++ b/unix/tclUnixPipe.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixPipe.c,v 1.15 2001/09/04 18:06:35 vincentdarley Exp $
+ * RCS: @(#) $Id: tclUnixPipe.c,v 1.16 2001/10/18 01:01:15 hobbs Exp $
*/
#include "tclInt.h"
@@ -1003,14 +1003,20 @@ PipeInputProc(instanceData, buf, toRead, errorCodePtr)
* appropriately, and read will unblock as soon as a short read is
* possible, if the channel is in blocking mode. If the channel is
* nonblocking, the read will never block.
+ * Some OSes can throw an interrupt error, for which we should
+ * immediately retry. [Bug #415131]
*/
- bytesRead = read(GetFd(psPtr->inFile), buf, (size_t) toRead);
- if (bytesRead > -1) {
- return bytesRead;
+ do {
+ bytesRead = read (GetFd(psPtr->inFile), buf, (size_t) toRead);
+ } while ((bytesRead < 0) && (errno == EINTR));
+
+ if (bytesRead < 0) {
+ *errorCodePtr = errno;
+ return -1;
+ } else {
+ return bytesRead;
}
- *errorCodePtr = errno;
- return -1;
}
/*
@@ -1043,12 +1049,22 @@ PipeOutputProc(instanceData, buf, toWrite, errorCodePtr)
int written;
*errorCodePtr = 0;
- written = write(GetFd(psPtr->outFile), buf, (size_t) toWrite);
- if (written > -1) {
- return written;
+
+ /*
+ * Some OSes can throw an interrupt error, for which we should
+ * immediately retry. [Bug #415131]
+ */
+
+ do {
+ written = write(GetFd(psPtr->outFile), buf, (size_t) toWrite);
+ } while ((written < 0) && (errno == EINTR));
+
+ if (written < 0) {
+ *errorCodePtr = errno;
+ return -1;
+ } else {
+ return written;
}
- *errorCodePtr = errno;
- return -1;
}
/*