Commit 868653f4 authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: add fflush() before ferror() check

As David Laight pointed out, there is not much point in calling
ferror() unless you call fflush() first.
Reported-by: default avatarDavid Laight <David.Laight@ACULAB.COM>
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent 5c816641
...@@ -979,6 +979,7 @@ static int conf_write_autoconf_cmd(const char *autoconf_name) ...@@ -979,6 +979,7 @@ static int conf_write_autoconf_cmd(const char *autoconf_name)
fprintf(out, "\n$(deps_config): ;\n"); fprintf(out, "\n$(deps_config): ;\n");
fflush(out);
ret = ferror(out); /* error check for all fprintf() calls */ ret = ferror(out); /* error check for all fprintf() calls */
fclose(out); fclose(out);
if (ret) if (ret)
...@@ -1097,6 +1098,7 @@ static int __conf_write_autoconf(const char *filename, ...@@ -1097,6 +1098,7 @@ static int __conf_write_autoconf(const char *filename,
if ((sym->flags & SYMBOL_WRITE) && sym->name) if ((sym->flags & SYMBOL_WRITE) && sym->name)
print_symbol(file, sym); print_symbol(file, sym);
fflush(file);
/* check possible errors in conf_write_heading() and print_symbol() */ /* check possible errors in conf_write_heading() and print_symbol() */
ret = ferror(file); ret = ferror(file);
fclose(file); fclose(file);
......
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