diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-12-22 11:50:44 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-12-22 11:50:44 +0000 | 
| commit | c14a5a8800a0f7a007f8cd197b4cad4d26a78f8c (patch) | |
| tree | a1dde3bcaa50b579a1c761196c9bb100d2021707 /contrib/llvm-project/compiler-rt | |
| parent | 3cf3b4e6419d14ed25c0b67b84763b3be937c8b5 (diff) | |
| parent | b96995b67f15110f39c41149543e19c8189abdaf (diff) | |
Notes
Diffstat (limited to 'contrib/llvm-project/compiler-rt')
| -rw-r--r-- | contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingUtil.c | 9 | 
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingUtil.c b/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingUtil.c index 02d100792db8..e28a3c8fabe0 100644 --- a/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingUtil.c +++ b/contrib/llvm-project/compiler-rt/lib/profile/InstrProfilingUtil.c @@ -189,8 +189,9 @@ COMPILER_RT_VISIBILITY FILE *lprofOpenFileEx(const char *ProfileName) {    f = fdopen(fd, "r+b");  #elif defined(_WIN32)    // FIXME: Use the wide variants to handle Unicode filenames. -  HANDLE h = CreateFileA(ProfileName, GENERIC_READ | GENERIC_WRITE, 0, 0, -                         OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); +  HANDLE h = CreateFileA(ProfileName, GENERIC_READ | GENERIC_WRITE, +                         FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_ALWAYS, +                         FILE_ATTRIBUTE_NORMAL, 0);    if (h == INVALID_HANDLE_VALUE)      return NULL; @@ -200,6 +201,10 @@ COMPILER_RT_VISIBILITY FILE *lprofOpenFileEx(const char *ProfileName) {      return NULL;    } +  if (lprofLockFd(fd) != 0) +    PROF_WARN("Data may be corrupted during profile merging : %s\n", +              "Fail to obtain file lock due to system limit."); +    f = _fdopen(fd, "r+b");    if (f == 0) {      CloseHandle(h);  | 
