pollita Fri Feb 23 23:09:14 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/main/streams plain_wrapper.c Log: MFH (r-1.82): Add retry for interrupted reads and graceful handling for failed retries http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.52.2.6.2.16&r2=1.52.2.6.2.17&diff_format=u Index: php-src/main/streams/plain_wrapper.c diff -u php-src/main/streams/plain_wrapper.c:1.52.2.6.2.16 php-src/main/streams/plain_wrapper.c:1.52.2.6.2.17 --- php-src/main/streams/plain_wrapper.c:1.52.2.6.2.16 Wed Feb 21 21:57:21 2007 +++ php-src/main/streams/plain_wrapper.c Fri Feb 23 23:09:14 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: plain_wrapper.c,v 1.52.2.6.2.16 2007/02/21 21:57:21 tony2001 Exp $ */ +/* $Id: plain_wrapper.c,v 1.52.2.6.2.17 2007/02/23 23:09:14 pollita Exp $ */ #include "php.h" #include "php_globals.h" @@ -333,8 +333,15 @@ return 0; } ret = read(data->fd, buf, count); - - stream->eof = (ret == 0 || (ret == (size_t)-1 && errno != EWOULDBLOCK)); + + 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 && errno != EINTR)); } else { #if HAVE_FLUSHIO
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php