* [PATCH] Check the `sectors' vector length before use it
@ 2009-07-26 21:21 Giuseppe Scrivano
0 siblings, 0 replies; only message in thread
From: Giuseppe Scrivano @ 2009-07-26 21:21 UTC (permalink / raw)
To: linux-btrfs
Hi all,
I noticed that the "btrfs-debug-tree -e DEVICE" command returns an empty
list. If it is a normal behaviour then this trivial patch solves a
problem in the show-blocks program, where the `sectors' vector is used
even in the case its length is zero.
Regards,
Giuseppe
>From 7caf73f4a7be8baa1493578c56477d3b279773ec Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sun, 26 Jul 2009 23:12:38 +0200
Subject: [PATCH] Check the vector length before use it
---
show-blocks | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/show-blocks b/show-blocks
index 0164be9..c6cdc12 100755
--- a/show-blocks
+++ b/show-blocks
@@ -228,7 +228,7 @@ shapeit(data)
sectors = data[:,0]
sizes = data[:,1]
datalen = len(data)
-sectormax = numpy.max(sectors)
+sectormax = numpy.max(sectors) if len(sectors) > 0 else 0
sectormin = 0
num_cells = 800
total_cells = num_cells * num_cells
--
1.6.3.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-07-26 21:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-26 21:21 [PATCH] Check the `sectors' vector length before use it Giuseppe Scrivano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox