sock.c: finally fix utterly broken opensock()

Oh boy! Opensock() was a victim of my brainless experiments. :-(