changeset 6915:85faf7df624e

* cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Abort if this macro is used before the first cycle_check call.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 04 Jul 2006 05:59:05 +0000
parents ca3b46b1eab7
children db0082829637
files lib/ChangeLog lib/cycle-check.h
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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-03  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* stdint_.h: Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
--- a/lib/cycle-check.h
+++ b/lib/cycle-check.h
@@ -45,6 +45,9 @@
 # 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;		\