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.
socket: cosmetics
socket: socket_base_exists_socket returns bool

Adapt the prototype to the actual used return value.
Merge pull request #2025 from OlegHahm/socket_init_fix_fix

net: socket: fix for e93d030058684f98894aafb5c4048b2c6d9d479f