firmware-utils: osbridge-crc: fix compiler warnings/errors
authorPetr Štetiar <ynezz@true.cz>
Sat, 20 Jul 2019 12:47:46 +0000 (14:47 +0200)
committerPetr Štetiar <ynezz@true.cz>
Tue, 23 Jul 2019 20:07:23 +0000 (22:07 +0200)
osbridge-crc.c:61:21: error: unused variable ‘board’ [-Werror=unused-variable]
osbridge-crc.c:167:2: error: label ‘out_flush’ defined but not used [-Werror=unused-label]
osbridge-crc.c:142: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/osbridge-crc.c

index 5fd236a0746c8885a0e96e6ba90065d4bd59509e..42aa22fae91d5a613a4508725be477114abb63ad 100644 (file)
@@ -58,7 +58,6 @@ static char *ofname;
 void usage(int status)
 {
        FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout;
-       struct board_info *board;
 
        fprintf(stream, "Usage: %s [OPTIONS...]\n", progname);
        fprintf(stream,
@@ -139,8 +138,8 @@ int main(int argc, char *argv[])
        }
 
        errno = 0;
-       fread(buf, buflen, 1, infile);
-       if (errno != 0) {
+       size_t r = fread(buf, buflen, 1, infile);
+       if (r != 1 && errno != 0) {
                ERRS("unable to read from file %s", ifname);
                goto err_close_in;
        }
@@ -164,7 +163,6 @@ int main(int argc, char *argv[])
 
        res = EXIT_SUCCESS;
 
- out_flush:
        fflush(outfile);
 
  err_close_out: