lkml.org 
[lkml]   [2022]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH AUTOSEL 5.16 06/30] kconfig: add fflush() before ferror() check
Date
From: Masahiro Yamada <masahiroy@kernel.org>

[ Upstream commit 868653f421cd37e8ec3880da19f0aac93f5c46cc ]

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>
Signed-off-by: Sasha Levin <sashal@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 027f4c28dc32..60545ed587fb 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -977,6 +977,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)
@@ -1095,6 +1096,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.35.1
\
 
 \ /
  Last update: 2022-04-07 17:29    [W:0.104 / U:2.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site