Issue 124474
Summary clang-tidy problem on read non-blocking file descriptor
Labels clang-tidy
Assignees
Reporter dpetrosy
    Hi!
I found some suspicious behavior of clang-tidy(version 19.1.3). When I call read on the non-blocking file descriptor, it reports [clang-analyzer-unix.BlockInCriticalSection]

Here is some example code:

```
std::mutex mtx;

void foo()
{
 std::lock_guard<std::mutex> lock(mtx);

    const char *filename = "example.txt";
    int fd = open(filename, O_RDONLY | O_NONBLOCK);

 char buffer[200] = {};
    read(fd, buffer, 199);
    close(fd);
}

int main()
{
    std::thread th(foo);
    th.join();
    return 0;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to