Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-12-06 00:02:53 +0300
committerChristopher Faylor <me@cgf.cx>2005-12-06 00:02:53 +0300
commitc34aee9b232aa388853c37acf29b1869d489072a (patch)
treef015fb0722bbcdbe2c1b4f1bc54f5cf350f097d1 /winsup/cygwin/dir.cc
parent4535b5961fc6055c9c59838b9fbcff20a71744b9 (diff)
* dir.cc (readdir_workdir): Only fill out d_ino when linked into older app.
* include/cygwin/version.h: Bump api minor number to 147, reflecting obsolescence of d_ino. (CYGWIN_VERSION_USER_API_VERSION_COMBINED): New convenience macro. (CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO): New convenience macro.
Diffstat (limited to 'winsup/cygwin/dir.cc')
-rw-r--r--winsup/cygwin/dir.cc82
1 files changed, 45 insertions, 37 deletions
diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
index 6faddf37b..a5ac1a2df 100644
--- a/winsup/cygwin/dir.cc
+++ b/winsup/cygwin/dir.cc
@@ -24,6 +24,8 @@ details. */
#include "dtable.h"
#include "cygheap.h"
#include "cygtls.h"
+#include "perprocess.h"
+#include "cygwin/version.h"
extern "C" int
dirfd (DIR *dir)
@@ -99,43 +101,49 @@ readdir_worker (DIR *dir, dirent *de)
}
if (!res)
- {
- /* Compute d_ino by combining filename hash with the directory hash
- (which was stored in dir->__d_dirhash when opendir was called). */
- if (de->d_name[0] == '.')
- {
- if (de->d_name[1] == '\0')
- {
- de->d_ino = dir->__d_dirhash;
- dir->__flags |= dirent_saw_dot;
- }
- else if (de->d_name[1] != '.' || de->d_name[2] != '\0')
- goto hashit;
- else
- {
- dir->__flags |= dirent_saw_dot_dot;
- char *p, up[strlen (dir->__d_dirname) + 1];
- strcpy (up, dir->__d_dirname);
- if (!(p = strrchr (up, '\\')))
- goto hashit;
- *p = '\0';
- if (!(p = strrchr (up, '\\')))
- de->d_ino = hash_path_name (0, ".");
- else
- {
- *p = '\0';
- de->d_ino = hash_path_name (0, up);
- }
- }
- }
- else
- {
- hashit:
- __ino64_t dino = hash_path_name (dir->__d_dirhash, "\\");
- de->d_ino = hash_path_name (dino, de->d_name);
- }
- de->__ino32 = de->d_ino; // for legacy applications
- }
+ if (!CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO)
+ {
+ de->__deprecated_d_ino = 0;
+ de->__ino32 = 0;
+ }
+ else
+ {
+ /* Compute __deprecated_d_ino by combining filename hash with the directory hash
+ (which was stored in dir->__d_dirhash when opendir was called). */
+ if (de->d_name[0] == '.')
+ {
+ if (de->d_name[1] == '\0')
+ {
+ de->__deprecated_d_ino = dir->__d_dirhash;
+ dir->__flags |= dirent_saw_dot;
+ }
+ else if (de->d_name[1] != '.' || de->d_name[2] != '\0')
+ goto hashit;
+ else
+ {
+ dir->__flags |= dirent_saw_dot_dot;
+ char *p, up[strlen (dir->__d_dirname) + 1];
+ strcpy (up, dir->__d_dirname);
+ if (!(p = strrchr (up, '\\')))
+ goto hashit;
+ *p = '\0';
+ if (!(p = strrchr (up, '\\')))
+ de->__deprecated_d_ino = hash_path_name (0, ".");
+ else
+ {
+ *p = '\0';
+ de->__deprecated_d_ino = hash_path_name (0, up);
+ }
+ }
+ }
+ else
+ {
+ hashit:
+ __ino64_t dino = hash_path_name (dir->__d_dirhash, "\\");
+ de->__deprecated_d_ino = hash_path_name (dino, de->d_name);
+ }
+ de->__ino32 = de->__deprecated_d_ino; // for legacy applications
+ }
return res;
}