From: John Crispin Date: Tue, 25 Aug 2015 20:43:18 +0000 (+0200) Subject: make jffs2reset not iterate over symlinked folders X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=eee7814420990b0a733fbc68defa56d4d0c388a7;p=oweals%2Ffstools.git make jffs2reset not iterate over symlinked folders Signed-off-by: John Crispin --- 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); }