Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / chroot.c
blobeb512c05f86f72ce4ed477dfbfc22ac6b5945044
1 // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.unix.Chroot -verify %s
3 extern int chroot(const char* path);
4 extern int chdir(const char* path);
6 void foo(void) {
9 void f1(void) {
10 chroot("/usr/local"); // root changed.
11 foo(); // expected-warning {{No call of chdir("/") immediately after chroot}}
14 void f2(void) {
15 chroot("/usr/local"); // root changed.
16 chdir("/"); // enter the jail.
17 foo(); // no-warning
20 void f3(void) {
21 chroot("/usr/local"); // root changed.
22 chdir("../"); // change working directory, still out of jail.
23 foo(); // expected-warning {{No call of chdir("/") immediately after chroot}}