From eee7814420990b0a733fbc68defa56d4d0c388a7 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 25 Aug 2015 22:43:18 +0200 Subject: [PATCH] make jffs2reset not iterate over symlinked folders Signed-off-by: John Crispin --- libfstools/overlay.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libfstools/overlay.c b/libfstools/overlay.c index 62a99f8..d6c311b 100644 --- a/libfstools/overlay.c +++ b/libfstools/overlay.c @@ -67,6 +67,7 @@ handle_rmdir(const char *dir) void foreachdir(const char *dir, int (*cb)(const char*)) { + struct stat s = { 0 }; char globdir[256]; glob_t gl; int j; @@ -78,7 +79,8 @@ foreachdir(const char *dir, int (*cb)(const char*)) if (!glob(globdir, GLOB_NOESCAPE | GLOB_MARK | GLOB_ONLYDIR, NULL, &gl)) for (j = 0; j < gl.gl_pathc; j++) - foreachdir(gl.gl_pathv[j], cb); + if (!stat(gl.gl_pathv[j], &s) && !S_ISLNK(s.st_mode)) + foreachdir(gl.gl_pathv[j], cb); cb(dir); } -- 2.25.1