The old code appears to be a hold-over from when the socket interface returned a fd instead of an error code.  I'll make a point to fix the other examples.