From: Christopher Dykes Date: Wed, 16 Nov 2016 21:19:59 +0000 (-0800) Subject: Hint that the port is numeric when binding an AsyncServerSocket X-Git-Tag: v2016.11.21.00~27 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e50abbcc72f209750aea57f8bb16944728e7b2a7;p=folly.git 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 --- 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)) {