Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check result of getaddrinfo() calls consistently #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Filkolev
Copy link

The getaddrinfo() function returns 0 on success or a non-zero error code on failure. For reference:

On Unix systems, errno is only set in the case where the return code is EAI_SYSTEM, therefore showing the errno code in all other cases would not provide meaningful information.

Print the return code of the function call along with errno to provide all the information needed to determine the cause of the error.

Add checks for the return code where they are missing.

The getaddrinfo() function returns 0 on success or a non-zero error code
on failure. For reference:
- https://man7.org/linux/man-pages/man3/getaddrinfo.3.html
- https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo

On Unix systems, errno is only set in the case where the return code is
EAI_SYSTEM, therefore showing the errno code in all other cases would
not provide meaningful information.

Print the return code of the function call along with errno to provide
all the information needed to determine the cause of the error.

Add checks for the return code where they are missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant