linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Weber <weber@corscience.de>
To: zippel@linux-m68k.org
Cc: Thomas Weber <weber@corscience.de>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] scripts: confdata: Fix fwrite warning
Date: Wed,  2 Jun 2010 16:44:19 +0200	[thread overview]
Message-ID: <1275489859-31874-1-git-send-email-weber@corscience.de> (raw)

I get for:
scripts/kconfig/confdata.c:508
scripts/kconfig/confdata.c:759
scripts/kconfig/confdata.c:760

warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result

So check the return value and handle the error.

Signed-off-by: Thomas Weber <weber@corscience.de>
---
 scripts/kconfig/confdata.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index c4dec80..4741fea 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -505,7 +505,10 @@ int conf_write(const char *name)
 				while (1) {
 					l = strcspn(str, "\"\\");
 					if (l) {
-						fwrite(str, l, 1, out);
+						if (fwrite(str, l, 1, out) != 1) {
+							fprintf(stderr, "write str failed\n");
+							return 1;
+						}
 						str += l;
 					}
 					if (!*str)
@@ -756,8 +759,14 @@ int conf_write_autoconf(void)
 			while (1) {
 				l = strcspn(str, "\"\\");
 				if (l) {
-					fwrite(str, l, 1, out);
-					fwrite(str, l, 1, out_h);
+					if (fwrite(str, l, 1, out) != 1) {
+						fprintf(stderr, "write str failed\n");
+						return 1;
+					}
+					if (fwrite(str, l, 1, out_h) != 1) {
+						fprintf(stderr, "write str failed\n");
+						return 1;
+					}
 					str += l;
 				}
 				if (!*str)
-- 
1.7.1


             reply	other threads:[~2010-06-02 14:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-02 14:44 Thomas Weber [this message]
2010-06-04 22:16 ` [PATCH] scripts: confdata: Fix fwrite warning Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1275489859-31874-1-git-send-email-weber@corscience.de \
    --to=weber@corscience.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).