File tree 1 file changed +12
-6
lines changed
compiler-rt/test/sanitizer_common/TestCases/Posix
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 1
- // RUN: %clangxx -O1 %s -o %t && %run %t %t.tmp
1
+ // RUN: rm -rf %t.tmp
2
+ // RUN: mkdir -p %t.tmp
3
+ // RUN: %clangxx -O1 %s -o %t && %run %t %t.tmp/1
2
4
3
5
#include < assert.h>
4
6
#include < fcntl.h>
5
- #include < unistd.h>
6
7
#include < sys/stat.h>
8
+ #include < unistd.h>
7
9
8
- int main (int argc, char *argv[]) {
9
- assert (argv[1 ]);
10
- unlink (argv[1 ]);
11
- int fd = open (argv[1 ], O_RDWR | O_CREAT, 0600 );
10
+ void test (const char *path, int flags) {
11
+ assert (path);
12
+ int fd = open (path, flags, 0600 );
12
13
assert (fd != -1 );
13
14
struct stat info;
14
15
int result = fstat (fd, &info);
15
16
assert ((info.st_mode & ~S_IFMT) == 0600 );
16
17
assert (result == 0 );
17
18
close (fd);
18
19
}
20
+
21
+ int main (int argc, char *argv[]) {
22
+ assert (argc == 2 );
23
+ test (argv[1 ], O_RDWR | O_CREAT);
24
+ }
You can’t perform that action at this time.
0 commit comments