The third argument for connect should be dependent on the address family. Issue spotted by piebeer who also wrote the patch.