Code

[PATCH] compat: missing dirent.d_type field
authorEdgar Toernig <froese@gmx.de>
Sat, 30 Apr 2005 16:51:03 +0000 (09:51 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 30 Apr 2005 16:51:03 +0000 (09:51 -0700)
Not everybody has "d_type".

cache.h
show-files.c

diff --git a/cache.h b/cache.h
index a10243d192f5444a58a056ef5a21a4386af26fb3..af6345820f3f8c533868394059b2d3b189e6b422 100644 (file)
--- a/cache.h
+++ b/cache.h
 #define deflateBound(c,s)  ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)
 #endif
 
+#ifdef DT_UNKNOWN
+#define DTYPE(de)      ((de)->d_type)
+#else
+#define DT_UNKNOWN     0
+#define DT_DIR         1
+#define DT_REG         2
+#define DTYPE(de)      DT_UNKNOWN
+#endif
+
 /*
  * Basic data structures for the directory cache
  *
index d4061f83031447aa9ee8ad16544e7bc084908838..c63c7aa4b79d9c00c331068c6390058f8795e346 100644 (file)
@@ -129,7 +129,7 @@ static void read_directory(const char *path, const char *base, int baselen)
                        len = strlen(de->d_name);
                        memcpy(fullname + baselen, de->d_name, len+1);
 
-                       switch (de->d_type) {
+                       switch (DTYPE(de)) {
                        struct stat st;
                        default:
                                continue;