net: socket: fix for e93d030058684f98894aafb5c4048b2c6d9d479f

The former fix for socket initialization was broken. This fixes the
"fix" by using the right exit condition for the loops.
Would it make sense to replace all ints by a smaller version, like uint8? I am not sure whether we will ever exceed a byte for the domain, type and protocol number (in the parameter list) or not.

Regarding the current line.. `i` could be reduced to uint8, too. I think we don't plan to support more than 255 sockets simultaneously, do we? (: