From: Jens Axboe Date: Wed, 23 Nov 2005 11:49:19 +0000 (+0100) Subject: [PATCH] sgioread: fix -s option X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=fce10cc679c1e1d79cc202d0762bf8410d41623e;p=disktools.git [PATCH] sgioread: fix -s option --- diff --git a/sgioread.c b/sgioread.c index f678fd6..2f1e988 100644 --- a/sgioread.c +++ b/sgioread.c @@ -218,6 +218,7 @@ int main(int argc, char *argv[]) buffer = ALIGN(ptr); lba = start_lba; + if (!nr_blocks) nr_blocks = end_lba - lba + 1; printf("disk %s: reading LBA %lu -> %lu", device, start_lba, end_lba); @@ -276,7 +277,7 @@ int main(int argc, char *argv[]) if (fd_out != -1) write_the_crap(fd_out, buffer, blocks * block_size); - } while (lba <= end_lba); + } while (lba <= end_lba && nr_blocks); print_datarate(sectors_since_last, time_spent); printf("\n");