mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kconfig: add fflush() before ferror() check
@ 2022-02-12 16:18 Masahiro Yamada
  2022-02-18  2:34 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2022-02-12 16:18 UTC (permalink / raw)
  To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada, David Laight

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>
---

 scripts/kconfig/confdata.c | 2 ++
 1 file changed, 2 insertions(+)

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);
-- 
2.32.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] kconfig: add fflush() before ferror() check
  2022-02-12 16:18 [PATCH] kconfig: add fflush() before ferror() check Masahiro Yamada
@ 2022-02-18  2:34 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2022-02-18  2:34 UTC (permalink / raw)
  To: Linux Kbuild mailing list; +Cc: Linux Kernel Mailing List, David Laight

On Sun, Feb 13, 2022 at 1:19 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> 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>
> ---

Applied to linux-kbuild.


>
>  scripts/kconfig/confdata.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> 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);
> --
> 2.32.0
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-18  2:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-12 16:18 [PATCH] kconfig: add fflush() before ferror() check Masahiro Yamada
2022-02-18  2:34 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®