Refactor: various: Use -1 consistently for uninitialized/invalid socket
System calls that create a socket (for example, socket(), accept())
return -1 to indicate error. 0 is technically a valid socket file
descriptor, even if it's unlikely to be encountered in practice because
0 is typically used for stdin. So we want to set socket file descriptor
variables to -1 if they're uninitialized or if we encountered an error,
and to check them accordingly.
We already did this in some places (for example, remoted_tls.c).
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>