History

kconfig: add fflush() before ferror() check

As David Laight pointed out, there is not much point in calling ferror() unless you call fflush() first.

Masahiro Yamada committed 4 years ago

Commit 868653f1 parent 5c816641 file · +2 −0Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/kconfig/confdata.c+2−0
@@ -979,6 +979,7 @@ static int conf_write_autoconf_cmd(const char *autoconf_name) · 978 unmodified lines
979979
980980 fprintf(out, "\n$(deps_config): ;\n");
981981
982+ fflush(out);
982983 ret = ferror(out); /* error check for all fprintf() calls */
983984 fclose(out);
984985 if (ret)
@@ -1097,6 +1098,7 @@ static int __conf_write_autoconf(const char *filename, · 112 unmodified lines
10971098 if ((sym->flags & SYMBOL_WRITE) && sym->name)
10981099 print_symbol(file, sym);
10991100
1101+ fflush(file);
11001102 /* check possible errors in conf_write_heading() and print_symbol() */
11011103 ret = ferror(file);
11021104 fclose(file);