The result of a pthread_ or posix_ function is tested for a negative value, which these functions never return
What it finds
Unlike most system calls, the pthread_ functions and the posix_ functions such as posix_fadvise and posix_memalign return 0 or a positive error number, never -1. A test with < 0 is always false and misses every error.
From the rule's source, posix_error_compared_negative.rs.
Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/cpp:posix-error-compared-negative" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/cpp:posix-error-compared-negative] reason="..."tx0 explain tx0/cpp:posix-error-compared-negative shows the same in the terminal. Found a false positive? Report it.