wrowe 2002/12/18 10:06:56
Modified: file_io/unix dir.c
Log:
Based on Philip Martin's research, we need to ignore any d_type results
of DT_UNKNOWN from dirread, and just to be thorough, we will lstat() any
file where the inode was (0/-1) as undefined values, or type was not in
our mappable list based on DT_ flags. This should resolve SVN's breakage.
Revision Changes Path
1.72 +20 -8 apr/file_io/unix/dir.c
Index: dir.c
===================================================================
RCS file: /home/cvs/apr/file_io/unix/dir.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- dir.c 18 Dec 2002 04:28:09 -0000 1.71
+++ dir.c 18 Dec 2002 18:06:56 -0000 1.72
@@ -172,6 +172,9 @@
apr_dir_t *thedir)
{
apr_status_t ret = 0;
+#ifdef DIRENT_TYPE
+ apr_filetype_e type;
+#endif
#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \
&& !defined(READDIR_IS_THREAD_SAFE)
struct dirent *retent;
@@ -218,11 +221,16 @@
return ret;
}
-#ifdef DIRENT_INODE
- wanted &= ~APR_FINFO_INODE;
-#endif
#ifdef DIRENT_TYPE
- wanted &= ~APR_FINFO_TYPE;
+ type = filetype_from_dirent_type(thedir->entry->DIRENT_TYPE);
+ if (type != APR_UNKFILE) {
+ wanted &= ~APR_FINFO_TYPE;
+ }
+#endif
+#ifdef DIRENT_INODE
+ if (thedir->entry->DIRENT_INODE && thedir->entry->DIRENT_INODE != -1) {
+ wanted &= ~APR_FINFO_INODE;
+ }
#endif
wanted &= ~APR_FINFO_NAME;
@@ -251,12 +259,16 @@
finfo->pool = thedir->pool;
finfo->valid = 0;
#ifdef DIRENT_TYPE
- finfo->filetype =
filetype_from_dirent_type(thedir->entry->DIRENT_TYPE);
- finfo->valid |= APR_FINFO_TYPE;
+ if (type != APR_UNKFILE) {
+ finfo->filetype = type;
+ finfo->valid |= APR_FINFO_TYPE;
+ }
#endif
#ifdef DIRENT_INODE
- finfo->inode = thedir->entry->DIRENT_INODE;
- finfo->valid |= APR_FINFO_INODE;
+ if (thedir->entry->DIRENT_INODE && thedir->entry->DIRENT_INODE !=
-1) {
+ finfo->inode = thedir->entry->DIRENT_INODE;
+ finfo->valid |= APR_FINFO_INODE;
+ }
#endif
}