[PATCH] scripts: confdata: Fix fwrite warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux