Skip to content

Commit a02cf90

Browse files
committed
compat/fnmatch/fnmatch.c: give a fall-back definition for NULL
Somebody tried to compile fnmatch.c compatibility file on Interix and got an error because no header included in the file on that platform defined NULL. It usually comes from stddef.h and indirectly from other headers like string.h, unistd.h, stdio.h, stdlib.h, etc., but with the way we compile this file from our Makefile, inclusion of the header files that are expected to define NULL in fnmatch.c do not happen because they are protected with "#ifdef STDC_HEADERS", etc. which we do not pass. As the least-impact workaround, give a fall-back definition when none of the headers define NULL. Noticed-by: Markus Duft <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5cfe425 commit a02cf90

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compat/fnmatch/fnmatch.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ extern char *getenv ();
127127
extern int errno;
128128
# endif
129129

130+
# ifndef NULL
131+
# define NULL 0
132+
# endif
133+
130134
/* This function doesn't exist on most systems. */
131135

132136
# if !defined HAVE___STRCHRNUL && !defined _LIBC

0 commit comments

Comments
 (0)