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

gcoap: gcoap_req_send and related should return negative for errors #19393

Open
bergzand opened this issue Mar 14, 2023 · 2 comments
Open

gcoap: gcoap_req_send and related should return negative for errors #19393

bergzand opened this issue Mar 14, 2023 · 2 comments
Labels
Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Comments

@bergzand
Copy link
Member

Description

gcoap_req_send currently returns non-zero positive on success and either zero or negative for failed transfers. This is error prone for users, even internally (see #19383).

Steps to reproduce the issue

Read the documentation

Expected results

Clear values for errors

Actual results

Both negative and zero are used to signal errors

@chrysn
Copy link
Member

chrysn commented Mar 14, 2023

This also affects gcoap_req_send_tl (which AIU is stuck in an API-compatibility-change deprecation cycle that hasn't been completed); are there any other function with weird zero results?

@bergzand
Copy link
Member Author

This also affects gcoap_req_send_tl (which AIU is stuck in an API-compatibility-change deprecation cycle that hasn't been completed); are there any other function with weird zero results?

gcoap_req_send_tl() is the cause behind this as gcoap_req_send() calls it with a specific socket type.

The other one I've found is not necessarily weird, but gcoap_obs_send squashes all negative error codes from the internal _tl_send() to zero. That's the only one I've found in the gcoap code.

@maribu maribu added the Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

No branches or pull requests

3 participants