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

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
979 979
980 fprintf(out, "\n$(deps_config): ;\n");980 fprintf(out, "\n$(deps_config): ;\n");
981 981
982 fflush(out);
982 ret = ferror(out); /* error check for all fprintf() calls */983 ret = ferror(out); /* error check for all fprintf() calls */
983 fclose(out);984 fclose(out);
984 if (ret)985 if (ret)
@@ -1097,6 +1098,7 @@ static int __conf_write_autoconf(const char *filename, · 112 unmodified lines
1097 if ((sym->flags & SYMBOL_WRITE) && sym->name)1098 if ((sym->flags & SYMBOL_WRITE) && sym->name)
1098 print_symbol(file, sym);1099 print_symbol(file, sym);
1099 1100
1101 fflush(file);
1100 /* check possible errors in conf_write_heading() and print_symbol() */1102 /* check possible errors in conf_write_heading() and print_symbol() */
1101 ret = ferror(file);1103 ret = ferror(file);
1102 fclose(file);1104 fclose(file);