EALREADY bug :-?

  • In the line number 856 of tsocks.c 1.8 beta 5 there is a check like this

    if (errno != EINPROGRESS) {
    show_msg(MSGERR, "Error %d attempting to connect to SOCKS "
                      "server (%s)\n", errno, strerror(errno));
             conn->state = FAILED;

    When connecting with a socksified smbclient (from the samba package) to the account of my college (don't ask why we have to use smb...) it appeared the message "Error 114 attempting to connect to SOCKS (Operation already in progress)".

    After looking for the errno value 114 I've discovered that it refers to EALREADY. According to "The GNU C Library Reference Manual": 

    "Some functions that must always block (such as connect;
    see Section 16.9.1 [Making a Connection], page 434) never return EAGAIN. Instead,
    they return EINPROGRESS to indicate that the operation has begun and will take some
    time. Attempts to manipulate the object before the call completes return EALREADY."

    So I have changed the if clause by

      if (errno != EINPROGRESS && errno != EALREADY) {

    and now it works. I don't know if this a good approach to solve the problem but I expect this helps.