X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=iolog.c;h=bfafc032f4bc63dc03964d4b050d2a0089723916;hp=7d5a136cacc7972f855b62ec518909dc0acb7b20;hb=583e0dfa7479be45b8a5ab7a53c9de88139683e4;hpb=e96c0125b80207677ea5367743fa69a2950acb48 diff --git a/iolog.c b/iolog.c index 7d5a136c..bfafc032 100644 --- a/iolog.c +++ b/iolog.c @@ -4,7 +4,6 @@ */ #include #include -#include #include #include #include @@ -15,11 +14,11 @@ #include "flist.h" #include "fio.h" -#include "verify.h" #include "trim.h" #include "filelock.h" #include "smalloc.h" #include "blktrace.h" +#include "pshared.h" static int iolog_flush(struct io_log *log); @@ -979,7 +978,7 @@ int iolog_file_inflate(const char *file) struct iolog_compress ic; z_stream stream; struct stat sb; - ssize_t ret; + size_t ret; size_t total; void *buf; FILE *f; @@ -1001,12 +1000,12 @@ int iolog_file_inflate(const char *file) ic.seq = 1; ret = fread(ic.buf, ic.len, 1, f); - if (ret < 0) { + if (ret == 0 && ferror(f)) { perror("fread"); fclose(f); free(buf); return 1; - } else if (ret != 1) { + } else if (ferror(f) || (!feof(f) && ret != 1)) { log_err("fio: short read on reading log\n"); fclose(f); free(buf);