Skip to content

Commit 63be37b

Browse files
author
Junio C Hamano
committed
DT_UNKNOWN: do not fully trust existence of DT_UNKNOWN
The recent Cygwin defines DT_UNKNOWN although it does not have d_type in struct dirent. Give an option to tell us not to use d_type on such platforms. Hopefully this problem will be transient. Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 35a730f commit 63be37b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ all:
2121
#
2222
# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
2323
#
24+
# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
25+
# d_type in struct dirent (latest Cygwin -- will be fixed soonish).
26+
#
2427
# Define NO_STRCASESTR if you don't have strcasestr.
2528
#
2629
# Define NO_SETENV if you don't have setenv in the C library.
@@ -236,6 +239,7 @@ ifeq ($(uname_S),SunOS)
236239
ALL_CFLAGS += -D__EXTENSIONS__
237240
endif
238241
ifeq ($(uname_O),Cygwin)
242+
NO_D_TYPE_IN_DIRENT = YesPlease
239243
NO_D_INO_IN_DIRENT = YesPlease
240244
NO_STRCASESTR = YesPlease
241245
NEEDS_LIBICONV = YesPlease
@@ -337,6 +341,9 @@ ifdef NEEDS_NSL
337341
LIBS += -lnsl
338342
SIMPLE_LIB += -lnsl
339343
endif
344+
ifdef NO_D_TYPE_IN_DIRENT
345+
ALL_CFLAGS += -DNO_D_TYPE_IN_DIRENT
346+
endif
340347
ifdef NO_D_INO_IN_DIRENT
341348
ALL_CFLAGS += -DNO_D_INO_IN_DIRENT
342349
endif

cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)
1111
#endif
1212

13-
#ifdef DT_UNKNOWN
13+
#if defined(DT_UNKNOWN) && !NO_D_TYPE_IN_DIRENT
1414
#define DTYPE(de) ((de)->d_type)
1515
#else
1616
#define DT_UNKNOWN 0

0 commit comments

Comments
 (0)