summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--partedUtils.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/partedUtils.py b/partedUtils.py
index 85aaa7a2e..44f9c8266 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -447,7 +447,14 @@ def sniffFilesystemType(device):
def getRedHatReleaseString(mountpoint):
if os.access(mountpoint + "/etc/redhat-release", os.R_OK):
f = open(mountpoint + "/etc/redhat-release", "r")
- lines = f.readlines()
+ try:
+ lines = f.readlines()
+ except IOError:
+ try:
+ f.close()
+ except:
+ pass
+ return ""
f.close()
# return the first line with the newline at the end stripped
if len(lines) == 0: