pollita Fri Feb 23 23:08:40 2007 UTC Modified files: /php-src/main/streams plain_wrapper.c Log: 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.81&r2=1.82&diff_format=u Index: php-src/main/streams/plain_wrapper.c diff -u php-src/main/streams/plain_wrapper.c:1.81 php-src/main/streams/plain_wrapper.c:1.82 --- php-src/main/streams/plain_wrapper.c:1.81 Wed Feb 21 21:56:45 2007 +++ php-src/main/streams/plain_wrapper.c Fri Feb 23 23:08:40 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: plain_wrapper.c,v 1.81 2007/02/21 21:56:45 tony2001 Exp $ */ +/* $Id: plain_wrapper.c,v 1.82 2007/02/23 23:08:40 pollita Exp $ */ #include "php.h" #include "php_globals.h" @@ -337,8 +337,15 @@ 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
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php