From f4ce3c99b316ce9f927786bd6df8594c53a12f0a Mon Sep 17 00:00:00 2001 From: Joel Granados Moreno Date: Thu, 9 Apr 2009 12:05:12 +0200 Subject: Close file descriptors when an error occurs. --- storage/formats/__init__.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'storage/formats/__init__.py') diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py index 784bb1c79..e68684c31 100644 --- a/storage/formats/__init__.py +++ b/storage/formats/__init__.py @@ -258,8 +258,10 @@ class DeviceFormat(object): pass else: log.error("error zeroing out %s: %s" % (self.device, e)) + os.close(fd) except Exception as e: log.error("error zeroing out %s: %s" % (self.device, e)) + os.close(fd) self.exists = False -- cgit