-
Notifications
You must be signed in to change notification settings - Fork 339
network: Translate WSA error codes to POSIX codes #1341
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
base: main
Are you sure you want to change the base?
Conversation
This is a good catch, but I think this points out a larger issue. We can't just fix the bugs we can see :) We need something like:
Anywhere we propagate the result of network_get_error() or a raw SO_ERROR value, you should run it through the translation layer on Windows. that would include connect and socket interfaces.
or wrap in a helper Functions with the same names as POSIX ( And there are others -
|
393ffc6
to
5255ace
Compare
5255ace
to
5beefa7
Compare
V1:
|
WSAStartup() returns 0 on success and positive error codes (WSA error codes) on failure. Checking if ret < 0 won't catch any error. https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsastartup Signed-off-by: Dan Nechita <dan.nechita@analog.com>
5beefa7
to
637fb20
Compare
PR Description
It has been observed that creating a network iio context with a wrong IP (that doesn't point to a system with iio devices) will cause a crash when executed in a Windows environment.
This happens because:
Fix this by translating a few common WSA error codes to POSIX codes that are know to be in the range of [1, 4095].
PR Type
PR Checklist