net/socket: Fix invalid socket type error handling