diff options
author | Jean Sacren <sakiwit@gmail.com> | 2010-08-04 18:01:02 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-08-12 18:40:26 -0400 |
commit | bf5e327a300a9ac959a89440e7c67dc89f3bd804 (patch) | |
tree | c8be365e0580656dd049e23ef5814bbafe8d73f5 | |
parent | 866af407dad3f2202e5d5d717ebd6156ccc33cdd (diff) |
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: Jean Sacren <sakiwit@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
-rw-r--r-- | scripts/kconfig/confdata.c | 2 | ||||
-rw-r--r-- | scripts/kconfig/expr.c | 2 | ||||
-rw-r--r-- | scripts/kconfig/lkc.h | 7 |
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, | |||
412 | while (1) { | 412 | while (1) { |
413 | l = strcspn(str, "\"\\"); | 413 | l = strcspn(str, "\"\\"); |
414 | if (l) { | 414 | if (l) { |
415 | fwrite(str, l, 1, out); | 415 | xfwrite(str, l, 1, out); |
416 | str += l; | 416 | str += l; |
417 | } | 417 | } |
418 | if (!*str) | 418 | 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 * | |||
1087 | 1087 | ||
1088 | static void expr_print_file_helper(void *data, struct symbol *sym, const char *str) | 1088 | static void expr_print_file_helper(void *data, struct symbol *sym, const char *str) |
1089 | { | 1089 | { |
1090 | fwrite(str, strlen(str), 1, data); | 1090 | xfwrite(str, strlen(str), 1, data); |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | void expr_fprint(struct expr *e, FILE *out) | 1093 | 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); | |||
80 | void sym_add_change_count(int count); | 80 | void sym_add_change_count(int count); |
81 | void conf_set_all_new_symbols(enum conf_def_mode mode); | 81 | void conf_set_all_new_symbols(enum conf_def_mode mode); |
82 | 82 | ||
83 | /* confdata.c and expr.c */ | ||
84 | static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) | ||
85 | { | ||
86 | if (fwrite(str, len, count, out) < count) | ||
87 | fprintf(stderr, "\nError in writing or end of file.\n"); | ||
88 | } | ||
89 | |||
83 | /* kconfig_load.c */ | 90 | /* kconfig_load.c */ |
84 | void kconfig_load(void); | 91 | void kconfig_load(void); |
85 | 92 | ||