tcp: check socket error when connect gets POLLHUP

This fixes a bug in d56ddab49d3e3433fb5b6e13d63f13f9eda27b57
in which we check the socket error. We erroneously checked the
pointer to the error, not the error itself. This commit fixes that.