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>
This commit is contained in:
Patrick Georgi 2015-04-29 13:53:14 +02:00 committed by Patrick Georgi
parent 2204539329
commit d36b80c791
2 changed files with 700 additions and 907 deletions

View File

@ -8,12 +8,12 @@
* Released under the terms of the GNU GPL v2.0. * Released under the terms of the GNU GPL v2.0.
*/ */
#include <glob.h>
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <wordexp.h>
#include "lkc.h" #include "lkc.h"
@ -339,17 +339,23 @@ void zconf_nextfile(const char *name)
void zconf_nextfiles(const char *wildcard) void zconf_nextfiles(const char *wildcard)
{ {
wordexp_t p; glob_t g;
char **w; char **w;
int i; int i;
wordexp(wildcard, &p, 0); if (glob(wildcard, 0, NULL, &g) != 0) {
w = p.we_wordv; return;
}
if (g.gl_pathv == NULL) {
globfree(&g);
return;
}
for (i = p.we_wordc - 1; i >= 0; i--) w = g.gl_pathv;
zconf_nextfile(w[i]); while (*w)
zconf_nextfile(*w++);
wordfree(&p); globfree(&g);
} }
static void zconf_endfile(void) static void zconf_endfile(void)

File diff suppressed because it is too large Load Diff