-
Notifications
You must be signed in to change notification settings - Fork 84
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
incompatible or wrong C11 Threads return value handling #429
Comments
Thanks for report, I'm currently preparing some PRs to fix incorrect return value checks: libre: #431 |
Thank you very much! |
I am sorry to tell you this but this is not fixed (does not work de facto). Specifically here: Line 27 in 18fb840
err is not zero then later Line 37 in 18fb840
mem_deref(m); will be called and non-zero err value returned ruining all the following code. The similarly wrong handling may be present in several other places, such as here: Line 210 in 18fb840
|
Thanks for pointing this out. I refactored the err handling: #476 |
Hi,
the problem is the following code:
re/src/main/main.c
Line 182 in 4dfae41
You assume that the success code is zero, which is not the case in FreeBSD implementation for example:
https://github.com/freebsd/freebsd-src/blob/3c9ad9398fcdf5f49114fde978b7c837b7ebbc8d/lib/libstdthreads/threads.h#L68
In the standard the value of
thrd_success
isunspecified
:https://en.cppreference.com/w/c/thread/thrd_errors
So I think return value of all functions related to threads.h must be explicitly compared with members of the
enum
Note that the specific line of code in libre source code might be not the only one existed in all 3 projects (re/rem/baresip).
Multiple places where return values get checked might be affected.
Regards,
Denis.
The text was updated successfully, but these errors were encountered: