firmware-utils: mkporayfw: fix compiler warnings/errors
authorPetr Štetiar <ynezz@true.cz>
Mon, 22 Jul 2019 09:46:49 +0000 (11:46 +0200)
committerPetr Štetiar <ynezz@true.cz>
Tue, 23 Jul 2019 20:07:23 +0000 (22:07 +0200)
mkporayfw.c:376:2: error: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Werror=unused-result]

Signed-off-by: Petr Štetiar <ynezz@true.cz>
tools/firmware-utils/src/mkporayfw.c

index 6ec4f320d93caaefc464801963364f812b40a188..59790ef3f43243439a117f78bcc1c61c357f6202 100644 (file)
@@ -373,8 +373,8 @@ static int read_to_buf(struct file_info *fdata, uint8_t *buf)
        }
 
        errno = 0;
-       fread(buf, fdata->file_size, 1, f);
-       if (errno != 0) {
+       size_t r = fread(buf, fdata->file_size, 1, f);
+       if (r != 1 || errno != 0) {
                ERRS("unable to read from file \"%s\"", fdata->file_name);
                goto out_close;
        }