diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-03-09 09:14:04 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-03-09 09:14:04 (GMT) |
commit | 8aca3246abd4f40476a6f99fce4ee021703a71e7 (patch) | |
tree | e26cad92aecdfba255148f5c3d54c7275cef6f6a /unix/tclUnixChan.c | |
parent | 3b584dd13f75df5189437493efabbd778b627520 (diff) | |
download | tcl-8aca3246abd4f40476a6f99fce4ee021703a71e7.zip tcl-8aca3246abd4f40476a6f99fce4ee021703a71e7.tar.gz tcl-8aca3246abd4f40476a6f99fce4ee021703a71e7.tar.bz2 |
Fix [8419c55e2c]: Tclsh read loop does not handle EINTR
Diffstat (limited to 'unix/tclUnixChan.c')
-rw-r--r-- | unix/tclUnixChan.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index fc01616..b49dde7 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -253,12 +253,15 @@ FileInputProc( * nonblocking, the read will never block. */ - bytesRead = read(fsPtr->fd, buf, (size_t) toRead); - if (bytesRead > -1) { - return bytesRead; + do { + bytesRead = read(fsPtr->fd, buf, (size_t) toRead); + } while ((bytesRead < 0) && (errno == EINTR)); + + if (bytesRead < 0) { + *errorCodePtr = errno; + return -1; } - *errorCodePtr = errno; - return -1; + return bytesRead; } /* |