Date: Sat, 23 Aug 2003 22:49:39 +0100 From: "Richard Dawe" Sender: rich AT phekda DOT freeserve DOT co DOT uk To: djgpp-workers AT delorie DOT com X-Mailer: Emacs 21.3.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6 Subject: Program to stat . before and after a chdir Message-Id: Reply-To: djgpp-workers AT delorie DOT com Hello. Could someone try the following program on Windows 2000/XP and post the results, please? I'm wondering if our stat is totally broken on Windows 2000/XP with respect to reporting inode numbers. If this program doesn't PASS, then I don't see how we can expect fileutils's rm to function correctly. I'm trying to understand the inode messages on Windows 2000/XP. I don't have either OS, so I can't try to reproduce it. I've never seen that error on my Windows '98 SE box. BTW the test PASSes on Windows '98 SE. Thanks, bye, Rich =] #include #include #include #include #include #include #include int main (int argc, char *argv[]) { struct stat sbuf_before, sbuf_after; char *cwd_before, *cwd_after; int ok = 1; memset(&sbuf_before, 0, sizeof(sbuf_before)); memset(&sbuf_after, 0, sizeof(sbuf_after)); cwd_before = getcwd(NULL, PATH_MAX); assert(cwd_before); if (stat(".", &sbuf_before) != 0) { perror(argv[0]); puts("FAIL"); return EXIT_FAILURE; } if (chdir(".") != 0) { perror(argv[0]); puts("FAIL"); return EXIT_FAILURE; } cwd_after = getcwd(NULL, PATH_MAX); assert(cwd_after); if (stat(".", &sbuf_after) != 0) { perror(argv[0]); puts("FAIL"); return EXIT_FAILURE; } if (strcmp(cwd_before, cwd_after) != 0) { puts("Directories different before and after\n"); ok = 0; } if (memcmp(&sbuf_before, &sbuf_after, sizeof(sbuf_before)) != 0) { puts("stat() results different before and after\n"); ok = 0; } free(cwd_before); free(cwd_after); puts(ok ? "PASS" : "FAIL"); return ok ? EXIT_SUCCESS : EXIT_FAILURE; }