[ 
https://issues.apache.org/jira/browse/THRIFT-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15344674#comment-15344674
 ] 

ASF GitHub Bot commented on THRIFT-2156:
----------------------------------------

Github user tpcwang commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1033#discussion_r68087139
  
    --- Diff: lib/cpp/src/thrift/transport/TServerSocket.cpp ---
    @@ -284,7 +284,7 @@ void TServerSocket::listen() {
       hints.ai_family = PF_UNSPEC;
       hints.ai_socktype = SOCK_STREAM;
       hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
    -  sprintf(port, "%d", port_);
    +  snprintf(port, sizeof("65535"), "%d", port_);
    --- End diff --
    
    sizeof(port) seems ever-so-slightly clearer.


> TServerSocket::listen() is throwing exceptions with misleading information
> --------------------------------------------------------------------------
>
>                 Key: THRIFT-2156
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2156
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9
>            Reporter: Frank Meerkoetter
>            Assignee: James E. King, III
>            Priority: Minor
>         Attachments: errno_copy.patch
>
>
> Due to a problem with bind() an exception was thrown.
> The text was:
> "Could not bind: Transport endpoint is not connected"
> which doesn't make sense.
> It turned out that errno had been overwritten.
> The correct text would have been:
> "Could not bind: Address already in use"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to