1
0
mirror of https://github.com/php/php-src.git synced 2026-03-30 04:02:19 +02:00

Fix reading from remote on some *nixes

This commit is contained in:
Bob Weinand
2014-10-20 08:46:22 +02:00
parent 07670ff871
commit 2916a14018
2 changed files with 14 additions and 1 deletions

View File

@@ -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;

View File

@@ -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;