summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2007-02-23 23:08:40 +0000
committerSara Golemon <pollita@php.net>2007-02-23 23:08:40 +0000
commit3b00d29d5a791844eee851d63ceb5e1d10965d76 (patch)
tree7ed1885bd4961dc4dcd45320333644b3bff4e1b3 /main
parentb4f2b5d1df3ebcc913a80a4edb513b713be084b7 (diff)
downloadphp-git-3b00d29d5a791844eee851d63ceb5e1d10965d76.tar.gz
Add retry for interrupted reads and graceful handling for failed retries
Diffstat (limited to 'main')
-rw-r--r--main/streams/plain_wrapper.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 83bf4c4dab..2688838481 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -337,8 +337,15 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS
return 0;
}
ret = read(data->fd, buf, count);
+
+ if (ret == (size_t)-1 && errno == EINTR) {
+ /* Read was interrupted, retry once,
+ If read still fails, giveup with feof==0
+ so script can retry if desired */
+ ret = read(data->fd, buf, count);
+ }
- stream->eof = (ret == 0 || (ret == (size_t)-1 && errno != EWOULDBLOCK));
+ stream->eof = (ret == 0 || (ret == (size_t)-1 && errno != EWOULDBLOCK && errno != EINTR));
} else {
#if HAVE_FLUSHIO