From eeae448805c0eb2ef130a6ac301750706bb80420 Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Wed, 9 Dec 2015 13:01:51 +0100 Subject: 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 --- sys-utils/blkdiscard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys-utils/blkdiscard.c') diff --git a/sys-utils/blkdiscard.c b/sys-utils/blkdiscard.c index bb4bae6ea..f36e50492 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); -- cgit v1.2.3-55-g7522