* [PATCH] gen_init_cpio: fixed fwrite warning
@ 2009-12-09 11:55 Mike Frysinger
2009-12-09 12:47 ` Michal Marek
0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2009-12-09 11:55 UTC (permalink / raw)
To: linux-kbuild, Andrew Morton; +Cc: linux-kernel
On compilers with security warnings enabled by default, we get:
usr/gen_init_cpio.c: In function ‘cpio_mkfile’:
usr/gen_init_cpio.c:357: warning: ignoring return value of ‘fwrite’,
declared with attribute warn_unused_result
So check the return value and handle errors accordingly.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
usr/gen_init_cpio.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index 83b3dde..b2b3c2d 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -354,7 +354,10 @@ static int cpio_mkfile(const char *name, const char *location,
push_pad();
if (size) {
- fwrite(filebuf, size, 1, stdout);
+ if (fwrite(filebuf, size, 1, stdout) != 1) {
+ fprintf(stderr, "writing filebuf failed\n");
+ goto error;
+ }
offset += size;
push_pad();
}
--
1.6.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-09 12:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-09 11:55 [PATCH] gen_init_cpio: fixed fwrite warning Mike Frysinger
2009-12-09 12:47 ` Michal Marek
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).