From ccbcfd79eca4d55692011d71911eb7efa7672e8d Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Sun, 10 May 2015 18:00:05 +0200 Subject: kconfig: handle globbed files backwards They're essentially collected on a stack before they're parsed. So we push them backwards, then parse them in the correct order. Change-Id: Ibf29559389cd19f260d67bae8e0b5ef9f4f58d91 Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/10169 Tested-by: build bot (Jenkins) Reviewed-by: Timothy Pearson --- util/kconfig/zconf.l | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'util/kconfig/zconf.l') 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); } -- cgit v1.2.3