summaryrefslogtreecommitdiff
path: root/scripts/kconfig/confdata.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2022-02-12 19:18:37 +0300
committerMasahiro Yamada <masahiroy@kernel.org>2022-02-18 05:33:35 +0300
commit868653f421cd37e8ec3880da19f0aac93f5c46cc (patch)
treec8e2b7931fed6b87bf3161cd97bff46513e487fc /scripts/kconfig/confdata.c
parent5c8166419acf468b5bc3e48f928a040485d3e0c2 (diff)
downloadlinux-868653f421cd37e8ec3880da19f0aac93f5c46cc.tar.xz
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>
Diffstat (limited to 'scripts/kconfig/confdata.c')
-rw-r--r--scripts/kconfig/confdata.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index d3c3a61308ad..94dcec2cc803 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -979,6 +979,7 @@ static int conf_write_autoconf_cmd(const char *autoconf_name)
fprintf(out, "\n$(deps_config): ;\n");
+ fflush(out);
ret = ferror(out); /* error check for all fprintf() calls */
fclose(out);
if (ret)
@@ -1097,6 +1098,7 @@ static int __conf_write_autoconf(const char *filename,
if ((sym->flags & SYMBOL_WRITE) && sym->name)
print_symbol(file, sym);
+ fflush(file);
/* check possible errors in conf_write_heading() and print_symbol() */
ret = ferror(file);
fclose(file);