From 1d7ccecde73f2148e4940b1839d8c77357870584 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 14 Dec 2015 09:33:30 -0800 Subject: [PATCH] fix "Address in use" crash --- src/core/security/server_secure_chttp2.c | 2 +- src/core/surface/server_chttp2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/security/server_secure_chttp2.c b/src/core/security/server_secure_chttp2.c index 6bda8a360c9..d1468e40e05 100644 --- a/src/core/security/server_secure_chttp2.c +++ b/src/core/security/server_secure_chttp2.c @@ -209,7 +209,7 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr, tcp, (struct sockaddr *)&resolved->addrs[i].addr, resolved->addrs[i].len); port_temp = grpc_tcp_listener_get_port(listener); - if (port_temp >= 0) { + if (port_temp > 0) { if (port_num == -1) { port_num = port_temp; } else { diff --git a/src/core/surface/server_chttp2.c b/src/core/surface/server_chttp2.c index 08691c858b9..5ce7c1955b8 100644 --- a/src/core/surface/server_chttp2.c +++ b/src/core/surface/server_chttp2.c @@ -109,7 +109,7 @@ int grpc_server_add_insecure_http2_port(grpc_server *server, const char *addr) { tcp, (struct sockaddr *)&resolved->addrs[i].addr, resolved->addrs[i].len); port_temp = grpc_tcp_listener_get_port(listener); - if (port_temp >= 0) { + if (port_temp > 0) { if (port_num == -1) { port_num = port_temp; } else {