[docs] Fix build-docs.sh
[llvm-project.git] / compiler-rt / test / tsan / Darwin / variadic-open.cpp
blobcd7684005cecae6454276f79d89fe83b73449731
1 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t %t.tmp 2>&1 | FileCheck %s
2 #include <stdio.h>
3 #include <assert.h>
4 #include <fcntl.h>
5 #include <unistd.h>
6 #include <sys/stat.h>
8 int main(int argc, char *argv[]) {
9 fprintf(stderr, "Hello world.\n");
10 assert(argv[1]);
11 unlink(argv[1]);
12 int fd = open(argv[1], O_RDWR | O_CREAT, 0600);
13 assert(fd != -1);
14 struct stat info;
15 int result = fstat(fd, &info);
16 fprintf(stderr, "permissions = 0%o\n", info.st_mode & ~S_IFMT);
17 assert(result == 0);
18 close(fd);
19 fprintf(stderr, "Done.\n");
22 // CHECK: Hello world.
23 // CHECK: permissions = 0600
24 // CHECK: Done.