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:
@@ -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;
|
||||
|
||||
12
phpdbg_io.c
12
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;
|
||||
|
||||
Reference in New Issue
Block a user