summaryrefslogtreecommitdiff
path: root/libfstools
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-08-25 22:43:18 +0200
committerJohn Crispin <blogic@openwrt.org>2015-08-26 01:28:44 +0200
commiteee7814420990b0a733fbc68defa56d4d0c388a7 (patch)
treecbb0161c003e776246681a097d642c95b5e45165 /libfstools
parentb439678db59311c697b3d93c42f763406567a7f3 (diff)
downloadfstools-eee7814420990b0a733fbc68defa56d4d0c388a7.tar.gz
make jffs2reset not iterate over symlinked folders
Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'libfstools')
-rw-r--r--libfstools/overlay.c4
1 files changed, 3 insertions, 1 deletions
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);
}