@@ -244,14 +244,29 @@ INTERCEPTOR(FILE *, fopen, const char *path, const char *mode) {
244
244
return REAL (fopen)(path, mode);
245
245
}
246
246
247
+ INTERCEPTOR (FILE *, freopen, const char *path, const char *mode, FILE *stream) {
248
+ __rtsan_notify_intercepted_call (" freopen" );
249
+ return REAL (freopen)(path, mode, stream);
250
+ }
251
+
252
+ // Streams
253
+
247
254
#if SANITIZER_INTERCEPT_FOPEN64
248
255
INTERCEPTOR (FILE *, fopen64, const char *path, const char *mode) {
249
256
__rtsan_notify_intercepted_call (" fopen64" );
250
257
return REAL (fopen64)(path, mode);
251
258
}
252
- #define RTSAN_MAYBE_INTERCEPT_FOPEN64 INTERCEPT_FUNCTION (fopen64)
259
+
260
+ INTERCEPTOR (FILE *, freopen64, const char *path, const char *mode,
261
+ FILE *stream) {
262
+ __rtsan_notify_intercepted_call (" freopen64" );
263
+ return REAL (freopen64)(path, mode, stream);
264
+ }
265
+ #define RTSAN_MAYBE_INTERCEPT_FOPEN64 INTERCEPT_FUNCTION (fopen64);
266
+ #define RTSAN_MAYBE_INTERCEPT_FREOPEN64 INTERCEPT_FUNCTION (freopen64);
253
267
#else
254
268
#define RTSAN_MAYBE_INTERCEPT_FOPEN64
269
+ #define RTSAN_MAYBE_INTERCEPT_FREOPEN64
255
270
#endif // SANITIZER_INTERCEPT_FOPEN64
256
271
257
272
INTERCEPTOR (size_t , fread, void *ptr, size_t size, size_t nitems,
@@ -276,7 +291,11 @@ INTERCEPTOR(int, fputs, const char *s, FILE *stream) {
276
291
return REAL (fputs)(s, stream);
277
292
}
278
293
279
- // Streams
294
+ INTERCEPTOR (FILE *, fdopen, int fd, const char *mode) {
295
+ __rtsan_notify_intercepted_call (" fdopen" );
296
+ return REAL (fdopen)(fd, mode);
297
+ }
298
+
280
299
INTERCEPTOR (int , puts, const char *s) {
281
300
__rtsan_notify_intercepted_call (" puts" );
282
301
return REAL (puts)(s);
@@ -904,6 +923,7 @@ void __rtsan::InitializeInterceptors() {
904
923
INTERCEPT_FUNCTION (close);
905
924
INTERCEPT_FUNCTION (fopen);
906
925
RTSAN_MAYBE_INTERCEPT_FOPEN64;
926
+ RTSAN_MAYBE_INTERCEPT_FREOPEN64;
907
927
INTERCEPT_FUNCTION (fread);
908
928
INTERCEPT_FUNCTION (read);
909
929
INTERCEPT_FUNCTION (write);
@@ -921,6 +941,8 @@ void __rtsan::InitializeInterceptors() {
921
941
RTSAN_MAYBE_INTERCEPT_CREAT64;
922
942
INTERCEPT_FUNCTION (puts);
923
943
INTERCEPT_FUNCTION (fputs);
944
+ INTERCEPT_FUNCTION (fdopen);
945
+ INTERCEPT_FUNCTION (freopen);
924
946
INTERCEPT_FUNCTION (lseek);
925
947
RTSAN_MAYBE_INTERCEPT_LSEEK64;
926
948
INTERCEPT_FUNCTION (dup);
0 commit comments