Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tsan] Fix the open and open64 interceptors to have correct declarati…
…ons (variadic functions) Not matching the (real) variadic declaration makes the interceptor take garbage inputs on Darwin/AArch64. Differential Revision: https://reviews.llvm.org/D84570
- Loading branch information
1 parent
0a00a7d
commit 1260a15
Showing
2 changed files
with
41 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// RUN: %clangxx_tsan -O1 %s -o %t && %run %t %t.tmp 2>&1 | FileCheck %s | ||
#include <stdio.h> | ||
#include <assert.h> | ||
#include <fcntl.h> | ||
#include <unistd.h> | ||
#include <sys/stat.h> | ||
|
||
int main(int argc, char *argv[]) { | ||
fprintf(stderr, "Hello world.\n"); | ||
assert(argv[1]); | ||
unlink(argv[1]); | ||
int fd = open(argv[1], O_RDWR | O_CREAT, 0600); | ||
assert(fd != -1); | ||
struct stat info; | ||
int result = fstat(fd, &info); | ||
fprintf(stderr, "permissions = 0%o\n", info.st_mode & ~S_IFMT); | ||
assert(result == 0); | ||
close(fd); | ||
fprintf(stderr, "Done.\n"); | ||
} | ||
|
||
// CHECK: Hello world. | ||
// CHECK: permissions = 0600 | ||
// CHECK: Done. |