// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.unix.Chroot -verify %s
externintchroot(constchar*path);externintchdir(constchar*path);voidfoo(void){}voidf1(void){chroot("/usr/local");// root changed.
foo();// expected-warning {{No call of chdir("/") immediately after chroot}}
}voidf2(void){chroot("/usr/local");// root changed.
chdir("/");// enter the jail.
foo();// no-warning
}voidf3(void){chroot("/usr/local");// root changed.
chdir("../");// change working directory, still out of jail.
foo();// expected-warning {{No call of chdir("/") immediately after chroot}}
}