summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--phpdbg_io.c7
-rw-r--r--phpdbg_io.h4
2 files changed, 6 insertions, 5 deletions
diff --git a/phpdbg_io.c b/phpdbg_io.c
index 753779a5df..019e1e8e1b 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 4d1b74044b..3ac8f4112d 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 */