Add compat/fopen.c which returns NULL on attempt to open directory
Some systems do not fail as expected when fread et al. are called on a directory stream. Replace fopen on such systems which will fail when the supplied path is a directory. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
40aab8119f
commit
cba22528fa
@ -204,6 +204,11 @@ void *gitmemmem(const void *haystack, size_t haystacklen,
|
||||
const void *needle, size_t needlelen);
|
||||
#endif
|
||||
|
||||
#ifdef FREAD_READS_DIRECTORIES
|
||||
#define fopen(a,b) git_fopen(a,b)
|
||||
extern FILE *git_fopen(const char*, const char*);
|
||||
#endif
|
||||
|
||||
#ifdef __GLIBC_PREREQ
|
||||
#if __GLIBC_PREREQ(2, 1)
|
||||
#define HAVE_STRCHRNUL
|
||||
|
Reference in New Issue
Block a user