X-Spam-Check-By: sourceware.org From: ericblake AT comcast DOT net (Eric Blake) To: Cygwin List Subject: d_ino bug in // Date: Mon, 27 Feb 2006 17:22:57 +0000 Message-Id: <022720061722.16369.440335710004E8DA00003FF122007507840A050E040D0C079D0A@comcast.net> Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com It looks like d_ino is not being correctly populated within //. Running the program below on snapshot 20060220 produced: $ ./foo Searching for //eblake, inode 10556217422951964268 entry 553: name match only (inode 14394969718775064264) 2098 entries processed $ cat foo.c #include #include #include #include #include #include #define DEFAULT_SHARE "eblake" int main(int argc, char**argv) { ino_t ino; struct stat sb; DIR *dirp; int i = 0; switch (argc) { case 1: argv[1] = DEFAULT_SHARE; break; case 2: break; default: printf("Usage: foo [sharename]\n" " Search // for sharename\n"); return 1; } if (chdir("//") < 0) { printf("chdir failed: %d %s\n", errno, strerror(errno)); return 1; } if (lstat(argv[1], &sb) < 0) { printf("lstat failed: %d %s\n", errno, strerror(errno)); return 1; } ino = sb.st_ino; printf("Searching for //%s, inode %llu\n", argv[1], ino); if ((dirp = opendir ("..")) == NULL) { printf("opendir failed: %d %s\n", errno, strerror(errno)); return 1; } while (1) { struct dirent *dp; errno = 0; i++; if ((dp = readdir (dirp)) == NULL) { if (errno) { printf("opendir failed: %d %s\n", errno, strerror(errno)); return 2; } else break; } if (ino == dp->d_ino) { if (strcasecmp(argv[1], dp->d_name) == 0) { printf("match found at entry %d\n", i); } else { printf("entry %d: inode match only (name %s)\n", i, dp->d_name); } } else if (strcasecmp(argv[1], dp->d_name) == 0) { printf("entry %d: name match only (inode %llu)\n", i, dp->d_ino); } } printf("%d entries processed\n", i); if (closedir (dirp) < 0) { printf("closedir failed: %d %s\n", errno, strerror(errno)); return 1; } return 0; } -- Eric Blake -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/