If getaddrinfo() fails inside _modbus_tcp_pi_connect() "rc" is returned at line 305.
This is not consistent with _modbus_tcp_connect that always return -1, and with the
documentation of modbus_connect().
"return rc" should be "return (-1)".
Moreover errno is not set, but this is a bigger issue, as errno is not set for
Return value of _modbus_tcp_pi_connect() on failure (closes #61)
Thank you for the report, the problem has been fixed.
errno is set explicitely by libmodbus or by the system call on Unix/Linux systems, I know the situation isn't as good on Windows. Feel free to indicate the missing errno you've catched.