public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kconfig: Fix checking return value of 'fwrite'
@ 2011-10-06 11:14 Reinhard Tartler
  2011-10-07  2:34 ` Cong Wang
  2011-10-07  3:29 ` Arnaud Lacombe
  0 siblings, 2 replies; 10+ messages in thread
From: Reinhard Tartler @ 2011-10-06 11:14 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Jean Sacren, Michal Marek, linux-kernel, vamos-dev

fwrite indicates '1' written member if a zero-length string is written.
---
 scripts/kconfig/lkc.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index b633bdb..727d265 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -90,7 +90,7 @@ struct conf_printer {
 /* confdata.c and expr.c */
 static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
 {
-	if (fwrite(str, len, count, out) < count)
+	if (len > 0 && fwrite(str, len, count, out) < count)
 		fprintf(stderr, "\nError in writing or end of file.\n");
 }
 
-- 
1.7.0.4

-- 
Reinhard Tartler                     Department of Computer Science IV
Martensstr 1, 91058 Erlangen Germany, University of Erlangen-Nuremberg
            http://www4.informatik.uni-erlangen.de/~tartler

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

end of thread, other threads:[~2012-01-14 23:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-06 11:14 [PATCH] kconfig: Fix checking return value of 'fwrite' Reinhard Tartler
2011-10-07  2:34 ` Cong Wang
2011-10-07  3:29 ` Arnaud Lacombe
2011-11-20 13:24   ` Michal Marek
2011-11-20 15:53     ` Reinhard Tartler
2011-11-23  5:53     ` Jean Sacren
2011-11-23  6:30       ` Reinhard Tartler
2011-11-23 18:05         ` Arnaud Lacombe
2011-11-25 23:42           ` [PATCH] kbuild: Fix compiler warning with assertion when calling 'fwrite' Jean Sacren
2012-01-14 23:19             ` Michal Marek

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