Commit bf5e327a authored by Jean Sacren's avatar Jean Sacren Committed by Michal Marek

kconfig: Fix warning: ignoring return value of 'fwrite'

This fix facilitates fwrite() in both confdata.c and expr.c, either it
succeeds in writing, or an error occurs, or the end of file is reached.
Signed-off-by: default avatarJean Sacren <sakiwit@gmail.com>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent 866af407
...@@ -412,7 +412,7 @@ static void conf_write_string(bool headerfile, const char *name, ...@@ -412,7 +412,7 @@ static void conf_write_string(bool headerfile, const char *name,
while (1) { while (1) {
l = strcspn(str, "\"\\"); l = strcspn(str, "\"\\");
if (l) { if (l) {
fwrite(str, l, 1, out); xfwrite(str, l, 1, out);
str += l; str += l;
} }
if (!*str) if (!*str)
......
...@@ -1087,7 +1087,7 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char * ...@@ -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) 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) void expr_fprint(struct expr *e, FILE *out)
......
...@@ -80,6 +80,13 @@ void sym_set_change_count(int count); ...@@ -80,6 +80,13 @@ void sym_set_change_count(int count);
void sym_add_change_count(int count); void sym_add_change_count(int count);
void conf_set_all_new_symbols(enum conf_def_mode mode); 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 */ /* kconfig_load.c */
void kconfig_load(void); void kconfig_load(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment