From 9025f2aa7db8d74735ca47496ef988c1562be1c0 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 19 Jan 2006 05:34:39 +0000 Subject: [PATCH] * dir.cc (readdir_worker): Fill in invalid fields with -1. Accommodate name change from __ino32 to __invalid_ino32. * include/sys/dirent.h (__invalid_ino32): Rename from __ino32. Don't define unused d_type macros. --- winsup/cygwin/ChangeLog | 7 +++++++ winsup/cygwin/dir.cc | 6 +++--- winsup/cygwin/include/sys/dirent.h | 6 ++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b0f4c2f72..796d03cca 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2006-01-19 Christopher Faylor + + * dir.cc (readdir_worker): Fill in invalid fields with -1. Accommodate + name change from __ino32 to __invalid_ino32. + * include/sys/dirent.h (__invalid_ino32): Rename from __ino32. Don't + define unused d_type macros. + 2006-01-18 Christopher Faylor * heap.cc (heap_init): Remove Sleep. diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index e00aa77ab..14f02d9a1 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -104,8 +104,8 @@ readdir_worker (DIR *dir, dirent *de) /* error return */; else if (!CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO) { - de->__invalid_d_ino = 0; - de->__ino32 = 0; + de->__invalid_d_ino = (ino_t) -1; + de->__invalid_ino32 = (uint32_t) -1; if (de->d_name[0] == '.') { if (de->d_name[1] == '\0') @@ -150,7 +150,7 @@ readdir_worker (DIR *dir, dirent *de) __ino64_t dino = hash_path_name (dir->__d_dirhash, "\\"); de->__invalid_d_ino = hash_path_name (dino, de->d_name); } - de->__ino32 = de->__invalid_d_ino; // for legacy applications + de->__invalid_ino32 = de->__invalid_d_ino; // for legacy applications } return res; } diff --git a/winsup/cygwin/include/sys/dirent.h b/winsup/cygwin/include/sys/dirent.h index d64ebe8c2..cfa4461ea 100644 --- a/winsup/cygwin/include/sys/dirent.h +++ b/winsup/cygwin/include/sys/dirent.h @@ -23,7 +23,7 @@ struct dirent __ino64_t __invalid_d_ino; long d_fd; /* File descriptor of open directory. Used since Cygwin 1.3.3. */ - unsigned __ino32; + unsigned __invalid_ino32; char d_name[256]; /* FIXME: use NAME_MAX? */ }; #else @@ -33,7 +33,7 @@ struct dirent long d_version; ino_t __invalid_d_ino; long d_fd; - unsigned long __ino32; + unsigned long __invalid_ino32; char d_name[256]; }; #else @@ -86,6 +86,7 @@ int scandir (const char *__dir, int (*compar) (const struct dirent **, const struct dirent **)); int alphasort (const struct dirent **__a, const struct dirent **__b); +#if 0 /* these make no sense in the absence of d_type */ /* File types for `d_type'. */ enum { @@ -112,5 +113,6 @@ enum /* Convert between stat structure types and directory types. */ # define IFTODT(mode) (((mode) & 0170000) >> 12) # define DTTOIF(dirtype) ((dirtype) << 12) +#endif #endif /* _POSIX_SOURCE */ #endif /*_SYS_DIRENT_H*/