summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2001-10-18 01:02:02 (GMT)
committerhobbs <hobbs@noemail.net>2001-10-18 01:02:02 (GMT)
commit7f7a33cf48adc9099d6628acbc1a4c5902a1a25a (patch)
tree953644505c829e5afc8615046c4540347e6967c1
parent72f65267c3e12afd833f729197f6dfab3c2f3129 (diff)
downloadtcl-7f7a33cf48adc9099d6628acbc1a4c5902a1a25a.zip
tcl-7f7a33cf48adc9099d6628acbc1a4c5902a1a25a.tar.gz
tcl-7f7a33cf48adc9099d6628acbc1a4c5902a1a25a.tar.bz2
* unix/tclUnixPipe.c (PipeInputProc, PipeOutputProc): do immediate
retry when error is returned with errno == EINTR. [Bug #415131] (leger) FossilOrigin-Name: 3f22675017d93e6a468d04938a97cd06b1c9a114
-rw-r--r--ChangeLog6
-rw-r--r--unix/tclUnixPipe.c38
2 files changed, 33 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index e0c5c8b..c3fe032 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-17 Daniel Steffen <das@users.sourceforge.net>
* mac/tclMacProjects.sea.hqx: updated projects with new version
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c
index f848616..9f04c3d 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.9.2.1 2001/04/03 22:54:39 hobbs Exp $
+ * RCS: @(#) $Id: tclUnixPipe.c,v 1.9.2.2 2001/10/18 01:02:02 hobbs Exp $
*/
#include "tclInt.h"
@@ -958,14 +958,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;
}
/*
@@ -998,12 +1004,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;
}
/*