[compiler-rt] r208772 - [libsanitizer] Notify the runtime about file being closed before the actual call to fclose().

Alexander Potapenko glider at google.com
Wed May 14 04:48:38 PDT 2014


Author: glider
Date: Wed May 14 06:48:37 2014
New Revision: 208772

URL: http://llvm.org/viewvc/llvm-project?rev=208772&view=rev
Log:
[libsanitizer] Notify the runtime about file being closed before the actual call to fclose().
This shall fix spurious false positive race reports between fclose() and fopen64().

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=208772&r1=208771&r2=208772&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Wed May 14 06:48:37 2014
@@ -4023,7 +4023,6 @@ INTERCEPTOR(int, fflush, __sanitizer_FIL
 INTERCEPTOR(int, fclose, __sanitizer_FILE *fp) {
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, fclose, fp);
-  int res = REAL(fclose)(fp);
   if (fp) {
     COMMON_INTERCEPTOR_FILE_CLOSE(ctx, fp);
     const FileMetadata *m = GetInterceptorMetadata(fp);
@@ -4032,7 +4031,7 @@ INTERCEPTOR(int, fclose, __sanitizer_FIL
       DeleteInterceptorMetadata(fp);
     }
   }
-  return res;
+  return REAL(fclose)(fp);
 }
 #define INIT_FCLOSE COMMON_INTERCEPT_FUNCTION(fclose);
 #else





More information about the llvm-commits mailing list