diff options
author | Eric Blake <ebb9@byu.net> | 2009-09-23 14:51:29 -0600 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-09-23 19:34:35 -0600 |
commit | b5eb8386645bf1bcfafa63c729ff9a86454def87 (patch) | |
tree | a82f1335e2fabfff7ea302f4b02d219b5fc84456 /lib/cycle-check.h | |
parent | e97114feaa74c5f0516d76dcde67601e26462e95 (diff) | |
download | gnulib-b5eb8386645bf1bcfafa63c729ff9a86454def87.tar.gz |
same-inode: make SAME_INODE tri-state, to port to mingw
Mingw has the annoying habit (already documented in
doc/posix-functions/*stat) that st_ino is always 0.
This means that naive uses of SAME_INODE(a,b) would
succeed, even on distinct files.
Here's an analysis of all gnulib modules that used
the macro before this commit:
chdir-safer is safe - SAME_INODE protected by HAVE_READLINK
cycle-check - mingw has no dir hard links and no symlinks,
so no directory cycles can occur, and we should ignore -1
fts - SAME_INODE protected by FTS_DEBUG
hash-triple - using -1 gives more hash collisions, but
the results are still correct
openat-proc - SAME_INODE protected by stat("/proc/self")
same - no dir cycles, so files are only same with identical name
link-follow.m4 - configure test already correct on mingw
test-canonicalize* - test already passes on mingw
test-[l]stat - test already passes on mingw
* NEWS: Mention this change.
* lib/same-inode.h (same-inode.h): Recognize mingw limitation of
st_ino always being 0.
* lib/cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Update caller.
* lib/cycle-check.c (cycle_check): Likewise.
* lib/same.c (same_name): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'lib/cycle-check.h')
-rw-r--r-- | lib/cycle-check.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/cycle-check.h b/lib/cycle-check.h index ee3bf214ba..ea9b9c4f08 100644 --- a/lib/cycle-check.h +++ b/lib/cycle-check.h @@ -1,6 +1,6 @@ /* help detect directory cycles efficiently - Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2006, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ bool cycle_check (struct cycle_check_state *state, struct stat const *sb); /* You must call cycle_check at least once before using this macro. */ \ if ((State)->chdir_counter == 0) \ abort (); \ - if (SAME_INODE ((State)->dev_ino, SB_subdir)) \ + if (SAME_INODE ((State)->dev_ino, SB_subdir) == 1) \ { \ (State)->dev_ino.st_dev = (SB_dir).st_dev; \ (State)->dev_ino.st_ino = (SB_dir).st_ino; \ |