[PATCH] blkrawverify: Check for EOF in error reporting
authorJens Axboe <axboe@suse.de>
Sat, 28 Jan 2006 19:39:11 +0000 (20:39 +0100)
committerJens Axboe <axboe@suse.de>
Sat, 28 Jan 2006 19:39:11 +0000 (20:39 +0100)
A check of fread returning 0 is not sufficient towards determining an.
error - 0 also indicates EOF. Added check for that.

blkrawverify.c

index 79fa56778d488ffe061e34f0a159d09cf9cf2536..9ed1f8baa9dc1a7fa78e3a3d11238c2ba0b88a4e 100644 (file)
@@ -199,7 +199,7 @@ static int process(FILE *ofp, char *file, unsigned int cpu)
                SWAP_BITS();
        }
 
-       if (n == 0)
+       if (n == 0 && !feof(ifp))
                fprintf(stderr,"%s: fread failed %d/%s\n",
                        file, errno, strerror(errno));
        fclose(ifp);