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

Return code from sendto, etc handled incorrectly in websocket_to_posix_proxy #16897

Open
glennra opened this issue May 6, 2022 · 2 comments · May be fixed by #16925
Open

Return code from sendto, etc handled incorrectly in websocket_to_posix_proxy #16897

glennra opened this issue May 6, 2022 · 2 comments · May be fixed by #16925

Comments

@glennra
Copy link

glennra commented May 6, 2022

The return code from sendto() and recvfrom() is the number of bytes sent or -1 for an error so the check for an error here should be ret<0, not ret!=0

errorCode = (ret != 0) ? GET_SOCKET_ERROR() : 0;

errorCode = (ret != 0) ? GET_SOCKET_ERROR() : 0;

@kripken
Copy link
Member

kripken commented May 6, 2022

cc @juj

juj added a commit to juj/emscripten that referenced this issue May 10, 2022
…tested against via if (ret < 0)). On Windows, Win32 API docs ask to check against SOCKET_ERROR and/or INVALID_SOCKET values, depending on API call in question. Fix bad error checks against value of zero and instead use checks that reflect the best practices on both platforms. Fixes emscripten-core#16897.
@juj juj linked a pull request May 10, 2022 that will close this issue
@juj
Copy link
Collaborator

juj commented May 10, 2022

Great observation @glennra , thanks for filing! Fix PR in #16925.

juj added a commit to juj/emscripten that referenced this issue Mar 6, 2023
…tested against via if (ret < 0)). On Windows, Win32 API docs ask to check against SOCKET_ERROR and/or INVALID_SOCKET values, depending on API call in question. Fix bad error checks against value of zero and instead use checks that reflect the best practices on both platforms. Fixes emscripten-core#16897.
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 a pull request may close this issue.

3 participants