summaryrefslogtreecommitdiff
path: root/util/kconfig/zconf.l
diff options
context:
space:
mode:
Diffstat (limited to 'util/kconfig/zconf.l')
-rw-r--r--util/kconfig/zconf.l11
1 files changed, 8 insertions, 3 deletions
diff --git a/util/kconfig/zconf.l b/util/kconfig/zconf.l
index e20d9c238e..b6bed02131 100644
--- a/util/kconfig/zconf.l
+++ b/util/kconfig/zconf.l
@@ -351,9 +351,14 @@ void zconf_nextfiles(const char *wildcard)
return;
}
- w = g.gl_pathv;
- while (*w)
- zconf_nextfile(*w++);
+ /* working through files backwards, since
+ * we're first pushing them on a stack
+ * before actually handling them.
+ */
+ for (i = g.gl_pathc; i > 0; i--) {
+ w = &g.gl_pathv[i - 1];
+ zconf_nextfile(*w);
+ }
globfree(&g);
}