blob: c5622f2345261c0f9aa2ab8c688cbdce7b9ac127 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// RUN: %check_clang_tidy %s android-cloexec-pipe %t
extern "C" int pipe(int pipefd[2]);
void warning() {
int pipefd[2];
pipe(pipefd);
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer pipe2() with O_CLOEXEC to avoid leaking file descriptors to child processes [android-cloexec-pipe]
// CHECK-FIXES: pipe2(pipefd, O_CLOEXEC);
}
namespace i {
int pipe(int pipefd[2]);
void noWarningInNamespace() {
int pipefd[2];
pipe(pipefd);
}
} // namespace i
class C {
public:
int pipe(int pipefd[2]);
void noWarningForMemberFunction() {
int pipefd[2];
pipe(pipefd);
}
};
|