Debian Codegraph @

clang-tools-extra/docs/clang-tidy/checks/bugprone/posix-return.rst

raw
1 .. title:: clang-tidy - bugprone-posix-return
2
3 bugprone-posix-return
4 =====================
5
6 Checks if any calls to ``pthread_*`` or ``posix_*`` functions
7 (except ``posix_openpt``) expect negative return values. These functions return
8 either ``0`` on success or an ``errno`` on failure, which is positive only.
9
10 Example buggy usage looks like:
11
12 .. code-block:: c
13
14 if (posix_fadvise(...) < 0) {
15
16 This will never happen as the return value is always non-negative. A simple fix could be:
17
18 .. code-block:: c
19
20 if (posix_fadvise(...) > 0) {