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

common: get_addr should return -1 on error #101

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

andcscott
Copy link
Contributor

Closes #96

  1. Update get_addr() to always return -1 on error
  2. Add test to ensure the error value is returned when host, port, flags, or result struct are invalid

src/common.c Outdated Show resolved Hide resolved
getaddrinfo will typically return negative values for errors, but this
is not the case for all systems. For example, glibc defines the errors
as negative, but the WSA equivalents are all positive. This commit
unifies the approach within iodine by always returning -1 in the event
getaddrinfo is unsuccessful.
@andcscott andcscott force-pushed the 98-get_addr-should-return-neg branch from 5574b77 to ae43de2 Compare October 29, 2024 22:38
@yarrick yarrick merged commit 2b65972 into yarrick:master Oct 30, 2024
6 checks passed
@yarrick
Copy link
Owner

yarrick commented Oct 30, 2024

Thanks!

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.

get_addr() should return -1 in case of error
2 participants