summaryrefslogtreecommitdiff
path: root/util/kconfig/confdata.c
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2022-10-28 01:00:26 +0200
committerPatrick Georgi <patrick@coreboot.org>2022-10-30 08:46:03 +0000
commit7eb03cb6574ed873f59a2c559e5ab079b9256b64 (patch)
tree2e69c522f8e5e87d4a6b8db7211b0c7eb0465b15 /util/kconfig/confdata.c
parent4c9b9e9709cef4937d012d6950e5e2932042c587 (diff)
util/kconfig: Uprev to Linux 5.17's kconfig
Another upstream refactoring, another local patch gone! TEST=`util/abuild/abuild -C` output (build.h and build.conf) remains the same Change-Id: I0f99dcbd8ecc7256551f0a6e2c83c060cb1999b6 Signed-off-by: Patrick Georgi <patrick@coreboot.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66046 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Diffstat (limited to 'util/kconfig/confdata.c')
-rw-r--r--util/kconfig/confdata.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/util/kconfig/confdata.c b/util/kconfig/confdata.c
index de421e0649..102f71659b 100644
--- a/util/kconfig/confdata.c
+++ b/util/kconfig/confdata.c
@@ -230,13 +230,6 @@ static const char *conf_get_autoheader_name(void)
return name ? name : "include/generated/autoconf.h";
}
-static const char *conf_get_autobase_name(void)
-{
- char *name = getenv("KCONFIG_SPLITCONFIG");
-
- return name ? name : "include/config/";
-}
-
static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
{
char *p2;
@@ -265,19 +258,21 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
p, sym->name);
return 1;
case S_STRING:
- if (*p++ != '"')
- break;
- for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
- if (*p2 == '"') {
- *p2 = 0;
+ /* No escaping for S_DEF_AUTO (include/config/auto.conf) */
+ if (def != S_DEF_AUTO) {
+ if (*p++ != '"')
break;
+ for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
+ if (*p2 == '"') {
+ *p2 = 0;
+ break;
+ }
+ memmove(p2, p2 + 1, strlen(p2));
}
- memmove(p2, p2 + 1, strlen(p2));
- }
- if (!p2) {
- if (def != S_DEF_AUTO)
+ if (!p2) {
conf_warning("invalid string found");
- return 1;
+ return 1;
+ }
}
/* fall through */
case S_INT:
@@ -732,7 +727,7 @@ static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym)
if (print_negatives) {
out = OUTPUT_N;
}
- __print_symbol(fp, sym, out, true);
+ __print_symbol(fp, sym, out, false);
}
void print_symbol_for_listconfig(struct symbol *sym)
@@ -1019,10 +1014,10 @@ static int conf_write_autoconf_cmd(const char *autoconf_name)
fprintf(out, "\n$(deps_config): ;\n");
- if (ferror(out)) /* error check for all fprintf() calls */
- return -1;
-
+ ret = ferror(out); /* error check for all fprintf() calls */
fclose(out);
+ if (ret)
+ return -1;
if (rename(tmp, name)) {
perror("rename");
@@ -1034,14 +1029,19 @@ static int conf_write_autoconf_cmd(const char *autoconf_name)
static int conf_touch_deps(void)
{
- const char *name;
+ const char *name, *tmp;
struct symbol *sym;
int res, i;
- strcpy(depfile_path, conf_get_autobase_name());
- depfile_prefix_len = strlen(depfile_path);
-
name = conf_get_autoconfig_name();
+ tmp = strrchr(name, '/');
+ depfile_prefix_len = tmp ? tmp - name + 1 : 0;
+ if (depfile_prefix_len + 1 > sizeof(depfile_path))
+ return -1;
+
+ strncpy(depfile_path, name, depfile_prefix_len);
+ depfile_path[depfile_prefix_len] = 0;
+
conf_read_simple(name, S_DEF_AUTO);
sym_calc_value(modules_sym);
@@ -1134,10 +1134,10 @@ static int __conf_write_autoconf(const char *filename,
print_symbol(file, sym);
/* check possible errors in conf_write_heading() and print_symbol() */
- if (ferror(file))
- return -1;
-
+ ret = ferror(file);
fclose(file);
+ if (ret)
+ return -1;
if (rename(tmp, filename)) {
perror("rename");