From e50abbcc72f209750aea57f8bb16944728e7b2a7 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Wed, 16 Nov 2016 13:19:59 -0800 Subject: [PATCH] Hint that the port is numeric when binding an AsyncServerSocket Summary: Because it had better be numeric or something is very wrong. Reviewed By: yfeldblum Differential Revision: D4190568 fbshipit-source-id: 52a5ebfcedb545201191fc48f66a4419eee8f748 --- folly/io/async/AsyncServerSocket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folly/io/async/AsyncServerSocket.cpp b/folly/io/async/AsyncServerSocket.cpp index e163da68..65d4c5c4 100644 --- a/folly/io/async/AsyncServerSocket.cpp +++ b/folly/io/async/AsyncServerSocket.cpp @@ -367,7 +367,7 @@ void AsyncServerSocket::bind(uint16_t port) { memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_PASSIVE; + hints.ai_flags = AI_PASSIVE | AI_NUMERICSERV; snprintf(sport, sizeof(sport), "%u", port); if (getaddrinfo(nullptr, sport, &hints, &res0)) { -- 2.34.1