bakaid commented on a change in pull request #713: MINIFICPP-1119 unify 
win/posix sockets + clean up issues
URL: https://github.com/apache/nifi-minifi-cpp/pull/713#discussion_r377195143
 
 

 ##########
 File path: libminifi/src/io/ClientSocket.cpp
 ##########
 @@ -242,39 +261,35 @@ int16_t Socket::initialize() {
   addrinfo* getaddrinfo_result = nullptr;
   const int errcode = getaddrinfo(requested_hostname_.c_str(), nullptr, 
&hints, &getaddrinfo_result);
   if (errcode != 0) {
-    logger_->log_error("Saw error during getaddrinfo, error: %lu", 
WSAGetLastError());
+    logger_->log_error("Saw error during getaddrinfo, error: %s", 
get_last_err_str());
 
 Review comment:
   I know this was an error originally present here, but while on Windows the 
`WSAGetLastError` -> `FormatMessage` path provided by `get_last_err_str` works 
fine, on POSIX `strerror(errno)` is of little use, instead `gai_strerror` 
should be used with the return value of `getaddrinfo` to get a usable error 
message: http://man7.org/linux/man-pages/man3/getaddrinfo.3.html

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to