[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Define the fd variable before it can ever be referenced (#496930).
- From: Chris Lumens <clumens redhat com>
- To: anaconda-devel-list redhat com
- Cc:
- Subject: [PATCH] Define the fd variable before it can ever be referenced (#496930).
- Date: Tue, 21 Apr 2009 13:09:56 -0400
---
storage/formats/__init__.py | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py
index e68684c..46a6576 100644
--- a/storage/formats/__init__.py
+++ b/storage/formats/__init__.py
@@ -246,6 +246,8 @@ class DeviceFormat(object):
# hope that it will wipe any metadata from filesystems that
# previously occupied this device
log.debug("zeroing out beginning and end of %s..." % self.device)
+ fd = None
+
try:
fd = os.open(self.device, os.O_RDWR)
buf = '\0' * 1024 * 1024
@@ -258,10 +260,13 @@ class DeviceFormat(object):
pass
else:
log.error("error zeroing out %s: %s" % (self.device, e))
- os.close(fd)
+
+ if fd:
+ os.close(fd)
except Exception as e:
log.error("error zeroing out %s: %s" % (self.device, e))
- os.close(fd)
+ if fd:
+ os.close(fd)
self.exists = False
--
1.6.1.3
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]