summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-07-03 15:20:23 +0000
committerJim Meyering <jim@meyering.net>2006-07-03 15:20:23 +0000
commit1a29d221b8c83adf79cdf4db0a58a23e58202e5f (patch)
treec310da2630d7e4b57e347d0b5b586327dd66a26d
parenta47c5ca291f51f1efcf3322b7e0aa0e31e6404e8 (diff)
downloadcoreutils-1a29d221b8c83adf79cdf4db0a58a23e58202e5f.tar.xz
* cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Abort if this
macro is used before the first cycle_check call.
-rw-r--r--lib/ChangeLog5
-rw-r--r--lib/cycle-check.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 1ce4084af..ab12de5f3 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,8 @@
+2006-07-03 Jim Meyering <jim@meyering.net>
+
+ * cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Abort if this
+ macro is used before the first cycle_check call.
+
2006-07-02 Paul Eggert <eggert@cs.ucla.edu>
* stdint_.h (intmax_t, uintmax_t): Prefer long to long long if
diff --git a/lib/cycle-check.h b/lib/cycle-check.h
index b137a60a8..927f3e51f 100644
--- a/lib/cycle-check.h
+++ b/lib/cycle-check.h
@@ -45,6 +45,9 @@ bool cycle_check (struct cycle_check_state *state, struct stat const *sb);
# define CYCLE_CHECK_REFLECT_CHDIR_UP(State, SB_dir, SB_subdir) \
do \
{ \
+ /* 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)) \
{ \
(State)->dev_ino.st_dev = (SB_dir).st_dev; \