[PATCH] Put in some handling for redundant method calls and devices containing '/'.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 cryptodev.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/cryptodev.py b/cryptodev.py
index 2cd14d7..080d198 100644
--- a/cryptodev.py
+++ b/cryptodev.py
@@ -62,10 +62,16 @@ class LUKSDevice:
         return self.scheme
 
     def setDevice(self, device):
+        if self._device == device:
+            return
+
         self._device = device
         if device is not None:
+            if device.startswith("/dev/"):
+                device = device[5:]
+
             name = "%s-%s" % (self.scheme.lower(),
-                              os.path.basename(device))
+                              device.replace("/", "-"))
             self.setName(name)
 
     def getDevice(self, encrypted=0):
@@ -78,6 +84,9 @@ class LUKSDevice:
 
     def setName(self, name, lock=False):
         """Set the name of the mapped device, eg: 'dmcrypt-sda3'"""
+        if self.name == name:
+            return
+
         if self.name and not self.getStatus():
             raise RuntimeError, "Cannot rename an active mapping."
 
-- 
1.5.4.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux