-
Notifications
You must be signed in to change notification settings - Fork 340
utils-windows: Add more WSA error codes #1355
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
Conversation
|
I don't know if you want to fix the rest of the On Windows, Here, it just reads errno, which is not updated for Winsock calls. same as in : On Windows, inet_ntop() is a Winsock call, so it sets and in
And this Win32 function: |
Add some more WSA error codes to the translation function what are likely to occur. Signed-off-by: Dan Nechita <dan.nechita@analog.com>
If setsockopt() and inet_ntop() fail when executed on Windows, the WSAGetLastError needs to be called to retrieve the specific error code and not use errno. Signed-off-by: Dan Nechita <dan.nechita@analog.com>
Signed-off-by: Dan Nechita <dan.nechita@analog.com>
15e408d to
37f3466
Compare
It would make sense to do so.
I have fixed both of the above.
The errors from
In dns_sd_windows the return value is ignored and in network-windows.c the return value is already handled.
Fixed.
The return values are never returned as the function calling GetAdaptersAdresses() is only interested in returning the number of sockets. Additionaly, I found that getaddrinfo() returns errors with naming convention EAI_. While these have the same values as WSA errors (they are simply aliases) on Windows, on Linux the EAI_* don't always map to the With these changes, no errors outside of [-4095, -1] should emerge. |
Unify and normalize getaddrinfo() return codes into libiio errno range. The issue: On Windows, getaddrinfo() may return large positive WSA codes (e.g. 11001, 11002) that were previously passed directly to iio_ptr(), leaking non-errno values. On Unix, EAI_* codes live in a separate namespace distinct from errno; feeding them directly would yield “Unknown error” messages. Solution: Add network_normalize_gai_error() (platform-specific) to convert every non-zero getaddrinfo() result before pointer encoding. - On Windows: WSA codes (≥10000) translated via translate_wsa_error_to_posix(); EAI_* aliases also covered. - On Unix: EAI_* mapped to meaningful errno equivalents (EAI_AGAIN→-EAGAIN, EAI_NONAME→-ENOENT, etc.) through a shared network_map_eai_code(). Signed-off-by: Dan Nechita <dan.nechita@analog.com>
37f3466 to
21eb318
Compare
rgetz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me - thanks
Add some more WSA error codes to the translation function what are likely to occur.
PR Description
Add more WSA errors to the translation function that are likely to be encountered.
PR Type
PR Checklist