aboutsummaryrefslogtreecommitdiff
path: root/util/kconfig/zconf.l
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2015-04-29 13:53:14 +0200
committerPatrick Georgi <pgeorgi@google.com>2015-05-04 22:26:09 +0200
commitd36b80c791a10d976f30388b8393136a85c14532 (patch)
tree0930259864c38469d3b3455436a7ff70426f97c6 /util/kconfig/zconf.l
parent2204539329429b84b2d09d1f89908bd68b3ae18c (diff)
kconfig: avoid using wordexp
OpenBSD refuses to implement it due to security concerns, so use glob instead. Change-Id: I7531cfe91deff240f7874d94d5acb340b87e51b6 Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: http://review.coreboot.org/10028 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util/kconfig/zconf.l')
-rw-r--r--util/kconfig/zconf.l20
1 files changed, 13 insertions, 7 deletions
diff --git a/util/kconfig/zconf.l b/util/kconfig/zconf.l
index b19e4de43c..e20d9c238e 100644
--- a/util/kconfig/zconf.l
+++ b/util/kconfig/zconf.l
@@ -8,12 +8,12 @@
* Released under the terms of the GNU GPL v2.0.
*/
+#include <glob.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <wordexp.h>
#include "lkc.h"
@@ -339,17 +339,23 @@ void zconf_nextfile(const char *name)
void zconf_nextfiles(const char *wildcard)
{
- wordexp_t p;
+ glob_t g;
char **w;
int i;
- wordexp(wildcard, &p, 0);
- w = p.we_wordv;
+ if (glob(wildcard, 0, NULL, &g) != 0) {
+ return;
+ }
+ if (g.gl_pathv == NULL) {
+ globfree(&g);
+ return;
+ }
- for (i = p.we_wordc - 1; i >= 0; i--)
- zconf_nextfile(w[i]);
+ w = g.gl_pathv;
+ while (*w)
+ zconf_nextfile(*w++);
- wordfree(&p);
+ globfree(&g);
}
static void zconf_endfile(void)