From: Ruediger Meier Date: Wed, 9 Dec 2015 12:01:51 +0000 (+0100) Subject: blkdiscard: don't report "zero range" at the end X-Git-Tag: v2.28-rc1~231 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eeae448805c0eb2ef130a6ac301750706bb80420;p=thirdparty%2Futil-linux.git blkdiscard: don't report "zero range" at the end We want to address the case that we have printed the last useful stats line already within the loop. Avoiding an additional line "Discarded 0 bytes ..." at the end. Note there is a behavior change now for the edge cases "-v -l 0" and "-v -o blksize" where we don't print any stats line anymore. But actually it's correct, we never make any BLKDISCARD syscall with zero range. Perhaps we should return error in these cases to help people who always want to parse stats output on success. CC: Federico Simoncelli Signed-off-by: Ruediger Meier --- diff --git a/sys-utils/blkdiscard.c b/sys-utils/blkdiscard.c index bb4bae6ea6..f36e504927 100644 --- a/sys-utils/blkdiscard.c +++ b/sys-utils/blkdiscard.c @@ -211,7 +211,7 @@ int main(int argc, char **argv) } } - if (verbose) + if (verbose && stats[1]) print_stats(path, stats); close(fd);