Signed-off-by: John Crispin <blogic@openwrt.org>
void
foreachdir(const char *dir, int (*cb)(const char*))
{
void
foreachdir(const char *dir, int (*cb)(const char*))
{
char globdir[256];
glob_t gl;
int j;
char globdir[256];
glob_t gl;
int j;
if (!glob(globdir, GLOB_NOESCAPE | GLOB_MARK | GLOB_ONLYDIR, NULL, &gl))
for (j = 0; j < gl.gl_pathc; j++)
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);