diff options
author | Michael Graichen <michael.graichen@hotmail.com> | 2020-04-09 14:39:44 +0000 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-04-14 10:12:53 +0200 |
commit | 7160a8507f2e6a2adddcca183d88675888452b40 (patch) | |
tree | 0c917742ff332f1c68351549c6e15b0c26a7891e /scripts | |
parent | e55bb6dc22ee9dc8746f3f969512988a1c593911 (diff) | |
download | barebox-7160a8507f2e6a2adddcca183d88675888452b40.tar.gz barebox-7160a8507f2e6a2adddcca183d88675888452b40.tar.xz |
scripts: zynq_mkimage: remove compiler warning
Fixes a warning while compiling zynq_mkimage.c
scripts/zynq_mkimage.c:312:2: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
fread returns the number bytes read, if it is not equal to st_size some error has happend
Signed-off-by: Michael Graichen <michael.graichen@hotmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/zynq_mkimage.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/zynq_mkimage.c b/scripts/zynq_mkimage.c index 0a1c069472..a211b79c28 100644 --- a/scripts/zynq_mkimage.c +++ b/scripts/zynq_mkimage.c @@ -241,7 +241,7 @@ int main(int argc, char *argv[]) char *buf; const char *infile = NULL, *outfile = NULL, *cfgfile = NULL; struct stat st; - int opt; + int opt, ret; prgname = argv[0]; @@ -309,7 +309,12 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - fread(buf + IMAGE_OFFSET, sizeof(char), st.st_size, ifile); + ret = fread(buf + IMAGE_OFFSET, sizeof(char), st.st_size, ifile); + + if(ret != st.st_size) { + fprintf(stderr, "Error while reading %s\n", infile); + exit(EXIT_FAILURE); + } add_header(buf, st.st_size); |