Skip to content

Commit 868653f

Browse files
committed
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: David Laight <David.Laight@ACULAB.COM> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent 5c81664 commit 868653f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

scripts/kconfig/confdata.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,7 @@ static int conf_write_autoconf_cmd(const char *autoconf_name)
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,
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);

0 commit comments

Comments
 (0)