summaryrefslogtreecommitdiff
blob: 6bffd896cb7d91f6bd3fd4f62621cdefbb06c79b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
http://bugs.gentoo.org/253119
http://savannah.gnu.org/bugs/index.php?25359
http://git.savannah.gnu.org/cgit/findutils.git/commit/?id=b445af98c22cd2d13673e2699a77ab728a7073b0

--- a/find/ftsfind.c
+++ b/find/ftsfind.c
@@ -227,7 +227,6 @@ visit(FTS *p, FTSENT *ent, struct stat *pstat)
 {
   struct predicate *eval_tree;
   
-  state.curdepth = ent->fts_level;
   state.have_stat = (ent->fts_info != FTS_NS) && (ent->fts_info != FTS_NSOK);
   state.rel_pathname = ent->fts_accpath;
   state.cwd_dir_fd   = p->fts_cwd_fd;
@@ -490,6 +489,10 @@ consider_visiting(FTS *p, FTSENT *ent)
 	}
     }
 
+  /* update state.curdepth before calling digest_mode(), because digest_mode
+   * may call following_links().
+   */
+  state.curdepth = ent->fts_level;
   if (mode)
     {
       if (!digest_mode(mode, ent->fts_path, ent->fts_name, &statbuf, 0))