diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/dir.h | 8 | ||||
-rw-r--r-- | win32/win32.c | 9 |
2 files changed, 13 insertions, 4 deletions
diff --git a/win32/dir.h b/win32/dir.h index 5a97f54623..04d87ebabc 100644 --- a/win32/dir.h +++ b/win32/dir.h @@ -8,6 +8,11 @@ # endif #endif +#define DT_UNKNOWN 0 +#define DT_DIR (S_IFDIR>>12) +#define DT_REG (S_IFREG>>12) +#define DT_LNK 10 + struct direct { long d_namlen; @@ -15,8 +20,7 @@ struct direct char *d_name; char *d_altname; /* short name */ short d_altlen; - char d_isdir; /* directory */ - char d_isrep; /* reparse point */ + uint8_t d_type; }; typedef struct { WCHAR *start; diff --git a/win32/win32.c b/win32/win32.c index 73163f6171..d2fde0751e 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2139,8 +2139,13 @@ readdir_internal(DIR *dirp, BOOL (*conv)(const WCHAR *, const WCHAR *, struct di // // Attributes // - dirp->dirstr.d_isdir = GetBit(dirp->bits, BitOfIsDir(dirp->loc)); - dirp->dirstr.d_isrep = GetBit(dirp->bits, BitOfIsRep(dirp->loc)); + /* ignore FILE_ATTRIBUTE_DIRECTORY as unreliable for reparse points */ + if (GetBit(dirp->bits, BitOfIsRep(dirp->loc))) + dirp->dirstr.d_type = DT_LNK; + else if (GetBit(dirp->bits, BitOfIsDir(dirp->loc))) + dirp->dirstr.d_type = DT_DIR; + else + dirp->dirstr.d_type = DT_REG; // // Now set up for the next call to readdir |