Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Favre-Felix <n.favrefelix@gmail.com>2012-03-11 17:40:16 +0400
committerNicolas Favre-Felix <n.favrefelix@gmail.com>2012-03-11 17:40:16 +0400
commit4cf7677d05ea35bbea171411a0bc6a5aa2662883 (patch)
tree6069acb3923c03a55a6419128cf68a6a098c729d /library.c
parentc18dcca60874f1bf68af6a839ae1a496db22657a (diff)
Make sure stream exists when checking for EOF.
Addressing issue #143.
Diffstat (limited to 'library.c')
-rw-r--r--library.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/library.c b/library.c
index 637c5d7c..faef6232 100644
--- a/library.c
+++ b/library.c
@@ -31,8 +31,13 @@ PHPAPI void redis_stream_close(RedisSock *redis_sock TSRMLS_DC) {
PHPAPI int redis_check_eof(RedisSock *redis_sock TSRMLS_DC)
{
- int eof = php_stream_eof(redis_sock->stream);
+ int eof;
int count = 0;
+
+ if (!redis_sock->stream)
+ return -1;
+
+ eof = php_stream_eof(redis_sock->stream);
while(eof) {
if((MULTI == redis_sock->mode) || redis_sock->watching || count++ == 10) { /* too many failures */
if(redis_sock->stream) { /* close stream if still here */