wasphin commented on code in PR #1818: URL: https://github.com/apache/incubator-brpc/pull/1818#discussion_r904520518
########## src/butil/endpoint.cpp: ########## @@ -193,12 +194,24 @@ int hostname2ip(const char* hostname, ip_t* ip) { return -1; } #else - char aux_buf[1024]; + int aux_buf_len = 1024; + std::unique_ptr<char[]> aux_buf(new char[aux_buf_len]); + int ret = 0; int error = 0; struct hostent ent; struct hostent* result = NULL; - if (gethostbyname_r(hostname, &ent, aux_buf, sizeof(aux_buf), - &result, &error) != 0 || result == NULL) { + do { + result = NULL; + error = 0; + ret = gethostbyname_r(hostname, &ent, aux_buf.get(), aux_buf_len, + &result, &error); Review Comment: 这一行格式其实建议调一下~ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org