lkml.org 
[lkml]   [2011]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] kconfig: Fix checking return value of 'fwrite'
Date
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


\
 
 \ /
  Last update: 2011-10-06 14:01    [W:1.508 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site