com php-src: Fix reading from remote on some *nixes: phpdbg_cmd.c phpdbg_io.c

From: Date: Mon, 20 Oct 2014 06:46:22 +0000
Subject: com php-src: Fix reading from remote on some *nixes: phpdbg_cmd.c phpdbg_io.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-82535@lists.php.net to get a copy of this message
Commit: 2916a14018c19fb6d38984e12eed930666dcb200 Author: Bob Weinand <bobwei9@hotmail.com> Mon, 20 Oct 2014 08:46:22 +0200 Parents: 07670ff8712dd39240b2050fd8014bf7aa8769c5 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2916a14018c19fb6d38984e12eed930666dcb200 Log: Fix reading from remote on some *nixes Changed paths: M phpdbg_cmd.c M phpdbg_io.c Diff: diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c index ae4925c..c09df70 100644 --- a/phpdbg_cmd.c +++ b/phpdbg_cmd.c @@ -23,6 +23,7 @@ #include "phpdbg_utils.h" #include "phpdbg_set.h" #include "phpdbg_prompt.h" +#include "phpdbg_io.h" ZEND_EXTERN_MODULE_GLOBALS(phpdbg); @@ -863,7 +864,7 @@ readline: } len += bytes; /* XXX export the timeout through INI??*/ - } while ((bytes = phpdbg_mixed_read(PHPDBG_G(io)[PHPDBG_STDIN].fd, buf + len, PHPDBG_MAX_CMD - len, -1)) > 0 || (errno == EINTR && bytes < 0)); + } while ((bytes = phpdbg_mixed_read(PHPDBG_G(io)[PHPDBG_STDIN].fd, buf + len, PHPDBG_MAX_CMD - len, -1 TSRMLS_CC)) > 0 || (errno == EINTR && bytes < 0)); if (bytes <= 0) { goto disconnect; diff --git a/phpdbg_io.c b/phpdbg_io.c index 79fd559..753779a 100644 --- a/phpdbg_io.c +++ b/phpdbg_io.c @@ -88,10 +88,22 @@ recv_once: /* There's something to read. Read what's available and proceed disregarding whether len could be exhausted or not.*/ int can_read = recv(sock, p, i, MSG_PEEK); +#ifndef _WIN32 + if (can_read == -1 && errno == EINTR) { + continue; + } +#endif i = can_read; } +#ifdef _WIN32 got_now = recv(sock, p, i, 0); +#else + do { + got_now = recv(sock, p, i, 0); + } while (got_now == -1 && errno == EINTR); +#endif + if (got_now == -1) { write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Read operation timed out!\n")); return -1;

« previous php.cvs (#82535) next »