git_fopen: fix a sparse 'not declared' warning
[gitweb.git] / git-compat-util.h
index bd04564a69a052ce856f2ba120855541c66fc650..6be55cf8b39b9322339f92479a1e8b3396a3813c 100644 (file)
@@ -689,10 +689,12 @@ char *gitstrdup(const char *s);
 #endif
 
 #ifdef FREAD_READS_DIRECTORIES
-#ifdef fopen
-#undef fopen
-#endif
-#define fopen(a,b) git_fopen(a,b)
+# if !defined(SUPPRESS_FOPEN_REDEFINITION)
+#  ifdef fopen
+#   undef fopen
+#  endif
+#  define fopen(a,b) git_fopen(a,b)
+# endif
 extern FILE *git_fopen(const char*, const char*);
 #endif