summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/kconfig/confdata.c2
-rw-r--r--scripts/kconfig/expr.c2
-rw-r--r--scripts/kconfig/lkc.h7
3 files changed, 9 insertions, 2 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index ac13f0ff8e81..c39327e60ea4 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -412,7 +412,7 @@ static void conf_write_string(bool headerfile, const char *name,
while (1) {
l = strcspn(str, "\"\\");
if (l) {
- fwrite(str, l, 1, out);
+ xfwrite(str, l, 1, out);
str += l;
}
if (!*str)
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 8f18e37892cb..330e7c0048a8 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1087,7 +1087,7 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
static void expr_print_file_helper(void *data, struct symbol *sym, const char *str)
{
- fwrite(str, strlen(str), 1, data);
+ xfwrite(str, strlen(str), 1, data);
}
void expr_fprint(struct expr *e, FILE *out)
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 76db065ed72c..2ac33f5d273c 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -80,6 +80,13 @@ void sym_set_change_count(int count);
void sym_add_change_count(int count);
void conf_set_all_new_symbols(enum conf_def_mode mode);
+/* confdata.c and expr.c */
+static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
+{
+ if (fwrite(str, len, count, out) < count)
+ fprintf(stderr, "\nError in writing or end of file.\n");
+}
+
/* kconfig_load.c */
void kconfig_load(void);