HomeClusterLabs Projects

Refactor: various: Use -1 consistently for uninitialized/invalid socket

This commit no longer exists in the repository. It may have been part of a branch which was deleted.

Description

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>

Details

Provenance
nrwahl2Authored on Jan 8 2025, 3:41 AM

Commit No Longer Exists

This commit no longer exists in the repository.