Check condition of socket() return value was wrong.

I found a incorrect check. Would you check this?