com php-src: Maybe-fix for krakjoe/phpdbg#120, fixed remote on darwin: phpdbg.c phpdbg_cmd.c

From: Date: Sat, 11 Oct 2014 21:36:12 +0000
Subject: com php-src: Maybe-fix for krakjoe/phpdbg#120, fixed remote on darwin: phpdbg.c phpdbg_cmd.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-82562@lists.php.net to get a copy of this message
Commit: e19c7899799d8b5b1eacf6335f994fcbac10e2b3 Author: Bob Weinand <bobwei9@hotmail.com> Sat, 11 Oct 2014 23:36:12 +0200 Parents: 3445e0e59ed8d3852664532f345e924f7100a54a Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e19c7899799d8b5b1eacf6335f994fcbac10e2b3 Log: Maybe-fix for krakjoe/phpdbg#120, fixed remote on darwin Bugs: https://bugs.php.net/120 Changed paths: M phpdbg.c M phpdbg_cmd.c Diff: diff --git a/phpdbg..c b/phpdbg.c index c27bf60..1a7a1f8 100644 --- a/phpdbg.c +++ b/phpdbg.c @@ -834,12 +834,10 @@ static void phpdbg_remote_close(int socket, FILE *stream) { } /* don't inline this, want to debug it easily, will inline when done */ -static int phpdbg_remote_init(const char* address, unsigned short port, int *server, int *socket, FILE **stream) { +static int phpdbg_remote_init(const char* address, unsigned short port, int server, int *socket, FILE **stream) { phpdbg_remote_close(*socket, *stream); - *server = phpdbg_open_socket(address, port); - - if (*server < 0) { + if (server < 0) { phpdbg_rlog(fileno(stderr), "Initializing connection on %s:%u failed", address, port); return FAILURE; @@ -852,7 +850,7 @@ static int phpdbg_remote_init(const char* address, unsigned short port, int *ser char buffer[20] = {0}; memset(&address, 0, size); - *socket = accept(*server, (struct sockaddr *) &address, &size); + *socket = accept(server, (struct sockaddr *) &address, &size); inet_ntop(AF_INET, &address.sin_addr, buffer, sizeof(buffer)); phpdbg_rlog(fileno(stderr), "connection established from %s", buffer); @@ -1302,7 +1300,8 @@ phpdbg_main: #ifndef _WIN32 /* setup remote server if necessary */ if (!cleaning && listen > 0) { - if (phpdbg_remote_init(address, listen, &server, &socket, &stream) == FAILURE) { + server = phpdbg_open_socket(address, listen); + if (phpdbg_remote_init(address, listen, server, &socket, &stream) == FAILURE) { exit(0); } @@ -1493,7 +1492,7 @@ phpdbg_interact: if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE) { /* renegociate connections */ - phpdbg_remote_init(address, listen, &server, &socket, &stream); + phpdbg_remote_init(address, listen, server, &socket, &stream); /* set streams */ if (stream) { diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c index 69f8eee..3eb4f72 100644 --- a/phpdbg_cmd.c +++ b/phpdbg_cmd.c @@ -834,8 +834,12 @@ readline: memcpy(buf, PHPDBG_G(input_buffer), len); } - while ((bytes = read(PHPDBG_G(io)[PHPDBG_STDIN].fd, buf + len, PHPDBG_MAX_CMD - len)) > 0) { + while ((bytes = read(PHPDBG_G(io)[PHPDBG_STDIN].fd, buf + len, PHPDBG_MAX_CMD - len)) > 0 || (errno == EINTR && bytes < 0)) { int i; + if (bytes <= 0) { + continue; + } + for (i = len; i < len + bytes; i++) { if (buf[i] == '\n') { PHPDBG_G(input_buflen) = len + bytes - 1 - i;

« previous php.cvs (#82562) next »