1// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p
2// RUN: %clangxx_msan -O3 %s -o %t && %run %t %p
3
4#include <assert.h>
5#include <glob.h>
6#include <stdio.h>
7#include <stdlib.h>
8
9int main(int argc, char *argv[]) {
10 assert(argc == 2);
11 char buf[1024];
12 snprintf(s: buf, maxlen: sizeof(buf), format: "%s/%s", argv[1], "glob_test_root/*c");
13
14 glob_t globbuf;
15 int res = glob(pattern: buf, flags: 0, errfunc: 0, pglob: &globbuf);
16 assert(res == GLOB_NOMATCH);
17 assert(globbuf.gl_pathc == 0);
18 if (globbuf.gl_pathv == 0)
19 exit(status: 0);
20 return 0;
21}
22

source code of compiler-rt/test/msan/Linux/glob_nomatch.cpp