1// RUN: %clangxx_msan -O0 %s -o %t && %run %t
2// RUN: %clangxx_msan -O1 %s -o %t && %run %t
3// RUN: %clangxx_msan -O2 %s -o %t && %run %t
4// RUN: %clangxx_msan -O3 %s -o %t && %run %t
5
6// RUN: %clangxx_msan -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
7// RUN: %clangxx_msan -O1 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
8// RUN: %clangxx_msan -O2 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
9// RUN: %clangxx_msan -O3 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
10
11// Test that readdir64 is intercepted as well as readdir.
12
13#include <sys/types.h>
14#include <dirent.h>
15#include <stdlib.h>
16
17
18int main(void) {
19 DIR *dir = opendir(name: ".");
20 struct dirent *d = readdir(dirp: dir);
21 if (d->d_name[0]) {
22 closedir(dirp: dir);
23 exit(status: 0);
24 }
25 closedir(dirp: dir);
26 return 0;
27}
28

source code of compiler-rt/test/msan/readdir64.cpp