com php-src: Fix for ports >= 1<<15: phpdbg _io.c phpdbg_io.h
| From: | Bob Weinand | Date: | Mon, 20 Oct 2014 07:47:35 +0000 |
| Subject: | com php-src: Fix for ports >= 1<<15: phpdbg _io.c phpdbg_io.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82532@lists.php.net to get a copy of this message | ||
Commit: fa1c26f0227a50ebb44d0dee65e87b3291f91d23
Author: Bob Weinand <bobwei9@hotmail.com> Mon, 20 Oct 2014 09:47:35 +0200
Parents: 2916a14018c19fb6d38984e12eed930666dcb200
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fa1c26f0227a50ebb44d0dee65e87b3291f91d23
Log:
Fix for ports >= 1<<15
Changed paths:
M phpdbg_io.c
M phpdbg_io.h
Diff:
diff --git a/phpdbg_io.c b/phpdbg_io.c
index 753779a..019e1e8 100644
--- a/phpdbg_io.c
+++ b/phpdbg_io.c
@@ -150,7 +150,7 @@ PHPDBG_API int phpdbg_mixed_write(int sock, const char *ptr, int len TSRMLS_DC)
}
-PHPDBG_API int phpdbg_open_socket(const char *interface, short port TSRMLS_DC) {
+PHPDBG_API int phpdbg_open_socket(const char *interface, unsigned short port TSRMLS_DC) {
struct addrinfo res;
int fd = phpdbg_create_listenable_socket(interface, port, &res TSRMLS_CC);
@@ -169,7 +169,7 @@ PHPDBG_API int phpdbg_open_socket(const char *interface, short port TSRMLS_DC) {
}
-PHPDBG_API int phpdbg_create_listenable_socket(const char *addr, int port, struct addrinfo
*addr_res TSRMLS_DC) {
+PHPDBG_API int phpdbg_create_listenable_socket(const char *addr, unsigned short port, struct
addrinfo *addr_res TSRMLS_DC) {
int sock = -1, rc;
int reuse = 1;
struct in6_addr serveraddr;
@@ -205,12 +205,13 @@ PHPDBG_API int phpdbg_create_listenable_socket(const char *addr, int port,
struc
}
}
- snprintf(port_buf, 7, "%d", port);
+ snprintf(port_buf, 7, "%u", port);
if (!any_addr) {
rc = getaddrinfo(addr, port_buf, &hints, &res);
} else {
rc = getaddrinfo(NULL, port_buf, &hints, &res);
}
+
if (0 != rc) {
#ifndef PHP_WIN32
if (rc == EAI_SYSTEM) {
diff --git a/phpdbg_io.h b/phpdbg_io.h
index 4d1b740...3ac8f41 100644
--- a/phpdbg_io.h
+++ b/phpdbg_io.h
@@ -26,8 +26,8 @@ PHPDBG_API int phpdbg_send_bytes(int sock, const char *ptr, int len);
PHPDBG_API int phpdbg_mixed_read(int sock, char *ptr, int len, int tmo TSRMLS_DC);
PHPDBG_API int phpdbg_mixed_write(int sock, const char *ptr, int len TSRMLS_DC);
-PHPDBG_API int phpdbg_create_listenable_socket(const char *addr, int port, struct addrinfo *res
TSRMLS_DC);
-PHPDBG_API int phpdbg_open_socket(const char *interface, short port TSRMLS_DC);
+PHPDBG_API int phpdbg_create_listenable_socket(const char *addr, unsigned short port, struct
addrinfo *res TSRMLS_DC);
+PHPDBG_API int phpdbg_open_socket(const char *interface, unsigned short port TSRMLS_DC);
PHPDBG_API void phpdbg_close_socket(int sock);
#endif /* PHPDBG_IO_H */