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

Bug#640637: live-magic: uses hardcoded errno values



Package: live-magic
Version: 1.14
Severity: normal
Tags: patch

Hi,

currently live-magic compares 'errno' values with hardcoded numeric values,
instead of using the constants of the 'errno' Python module.
This can lead to bugs due to E* values being potentially different per-OS,
and even per-arch for the same OS.

The attached patch fixes the issue.

Thanks,
-- 
Pino
diff --git a/DebianLive/elements/folder_of_files.py b/DebianLive/elements/folder_of_files.py
index d48af4d..0f0bc4e 100644
--- a/DebianLive/elements/folder_of_files.py
+++ b/DebianLive/elements/folder_of_files.py
@@ -18,6 +18,7 @@
 
 import glob
 import os
+import errno
 
 from os.path import join
 
@@ -44,7 +45,7 @@ class FolderOfFiles(dict):
                     f.close()
             except IOError, e:
                 # "Is a directory"
-                if e.errno == 21:
+                if e.errno == errno.EISDIR:
                     continue
 
     def __delitem__(self, k):

Reply to: