[PATCH] protect os.access calls from None (#825337)

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

 



From: "Brian C. Lane" <bcl@xxxxxxxxxx>

On Parallels it has a fstab entry that starts with:

none /media/pfs prl_fs

which causes the NoDevice object to have a path of None.
---
 pyanaconda/storage/devices.py |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index bee2d24..d2e5ae6 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -908,9 +908,7 @@ class StorageDevice(Device):
                 True    the device is open and ready for use
                 False   the device is not open
         """
-        if not self.exists:
-            return False
-        return os.access(self.path, os.W_OK)
+        return self.exists and self.path and os.access(self.path, os.W_OK)
 
     def _setFormat(self, format):
         """ Set the Device's format. """
@@ -3489,7 +3487,7 @@ class FileDevice(StorageDevice):
         except (AttributeError, IndexError):
             # either this device has no parents or something is wrong with
             # the first one
-            status = (os.access(self.name, os.R_OK) and
+            status = (self.name and os.access(self.name, os.R_OK) and
                       self.parents in ([], None))
         else:
             # this is the actual active mountpoint
-- 
1.7.7.6

_______________________________________________
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