Mail Archives: djgpp-workers/2003/08/23/18:23:29
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <limits.h>
#include <assert.h>
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;
}
- Raw text -