From cbb499e7e385d99d11e7f17fb21b71fcc92ccbe6 Mon Sep 17 00:00:00 2001 From: lars Date: Mon, 28 Jan 2008 21:41:55 +0000 Subject: [PATCH] skip unreadable blockdevices (e.g. partitionable devices) --- src/cryptobox/core/blockdevice.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/cryptobox/core/blockdevice.py b/src/cryptobox/core/blockdevice.py index 5473cd8..ada7024 100644 --- a/src/cryptobox/core/blockdevice.py +++ b/src/cryptobox/core/blockdevice.py @@ -573,6 +573,10 @@ class Blockdevice: LOGGER.warning("Failed to call '%s' to determine UUID: %s" % \ (prefs["Programs"]["blkid"], err_msg)) return None + if proc.returncode == 2: + ## the device does not contain a filesystem (e.g. it is zeroed or + ## it contains a partition table) + return None if proc.returncode != 0: LOGGER.warning("Execution of '%s' for '%s' failed: %s" % \ (prefs["Programs"]["blkid"], self.devnodes[0], @@ -612,6 +616,10 @@ class Blockdevice: % prefs["Programs"]["blkid"] + "'%s': %s" % \ (self.devnodes[0], err_msg)) return None + if proc.returncode == 2: + ## the device does not contain a filesystem (e.g. it is zeroed or + ## it contains a partition table) + return None if proc.returncode != 0: LOGGER.warning("Execution of '%s' for '%s' failed: %s" % \ (prefs["Programs"]["blkid"], self.devnodes[0], @@ -652,6 +660,10 @@ class Blockdevice: % prefs["Programs"]["blkid"] + " '%s': %s" % \ (self.devnodes[0], err_msg)) return None + if proc.returncode == 2: + ## the device does not contain a filesystem (e.g. it is zeroed or + ## it contains a partition table) + return None if proc.returncode != 0: LOGGER.warning("Execution of '%s' for '%s' failed: %s" % \ (prefs["Programs"]["blkid"], self.devnodes[0],