#define MAXFD 256
+/* For some reason, Cygwin has started leaving cruft in the top bits of inode
+ * numbers, which breaks this test. Mask them off.
+ */
+#if defined(__CYGWIN__) && defined(__amd64__)
+# define HACK_INODE(ino) ((ino)&0xffffffffffff)
+#else
+# define HACK_INODE(ino) (ino)
+#endif
+
static void fail(const char *what) { perror(what); exit(1); }
int main(int argc, char *argv[])
unlink(",delete-me");
if (fd2 != fd) { if (dup2(fd2, fd) < 0) fail("dup2"); close(fd2); }
if (fstat(fd, &st)) fail("fstat");
- ino[i] = st.st_ino;
+ ino[i] = HACK_INODE(st.st_ino);
if (verbose)
printf("open fd %d[%d] = ino %lu\n", fd, i, (unsigned long)ino[i]);
}
} else if (fstat(fd, &st)) {
printf("fstat %d[%d] failed: %s\n", fd, i, strerror(errno));
win = 0;
- } else if (st.st_ino != ino[i]) {
+ } else if (HACK_INODE(st.st_ino) != ino[i]) {
if (!verbose) printf("ino %d[%d] wrong\n", fd, i);
else printf("ino %d[%d] = %lu != %lu\n", fd, i,
- (unsigned long)(st.st_ino), (unsigned long)ino[i]);
+ (unsigned long)HACK_INODE(st.st_ino),
+ (unsigned long)ino[i]);
win = 0;
}
}