[sabayon: 10/19] fixed potential exception in storage.py



commit 4d92741538d5b4c1111b52c7d1e2a5f79430bd22
Author: Scott Balneaves <sbalneav ltsp org>
Date:   Fri Sep 4 12:58:17 2009 -0500

    fixed potential exception in storage.py

 lib/storage.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/lib/storage.py b/lib/storage.py
index d230397..30337d2 100755
--- a/lib/storage.py
+++ b/lib/storage.py
@@ -481,8 +481,10 @@ class ProfileStorage:
                     raise err
 
             if got_stat:
-                os.unlink (dest) # FIXME: this could fail, but that would be because the parent
-                                 # directory is not writable.  Then we have bigger problems, anyway.
+                try:
+                    os.unlink (dest)
+                except OSError, err:
+                    raise ProfileStorageException (_("Couldn't unlink file '%s'") % dest)
 
             # FIXME: we lose the "original" permissions, mtime, etc. with ZIP files.
             shutil.copy2 (src, dest)
@@ -638,7 +640,6 @@ class ProfileStorage:
         except:
             if backup:
                 failsafe_rename (backup, self.path)
-            raise
 
         if backup:
             os.remove (backup)



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