diff --git a/tools/zio-dump.c b/tools/zio-dump.c index 9087d1479dfb04a26f9526b4965541aafb5167e9..a7866b84196461cfe1e92ea2ebdc0a605ac19e24 100644 --- a/tools/zio-dump.c +++ b/tools/zio-dump.c @@ -54,10 +54,15 @@ void print_attributes(struct zio_control *ctrl) ctrl->attr_trigger.ext_val); } -static void ziodump_dataeof(int cfd, int dfd) +static void ziodump_dataeof(int cfd, int dfd, int expected_size) { struct stat stbuf; + if (!expected_size) { + /* We got a zero-size block, so report end-of-data */ + printf("\n"); + return; + } /* * If ctrl == data and this is a regular file, EOF is expected * (it is likely the current-ctrl in sysfs). If not a regular file @@ -159,7 +164,7 @@ void read_channel(int cfd, int dfd, FILE *log) return; /* next ctrl, let's see... */ } if (!i) { /* EOF: handle the various cases */ - ziodump_dataeof(cfd, dfd); + ziodump_dataeof(cfd, dfd, ctrl.nsamples * ctrl.ssize); return; } if (i != ctrl.nsamples * ctrl.ssize) {