diff options
Diffstat (limited to 'kernellib.py')
-rwxr-xr-x | kernellib.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/kernellib.py b/kernellib.py index d201ac8..921a37a 100755 --- a/kernellib.py +++ b/kernellib.py @@ -58,10 +58,11 @@ KERNEL_TYPES = [ 'vserver', 'win4lin', 'wolk-dev', 'wolk', 'xbox', 'xen', 'xfs' ] -VERSION = '0.5.5' +VERSION = '0.5.6' NOCVE = 'GENERIC-MAP-NOMATCH' CVES = dict() PORTDIR = portage.settings['PORTDIR'] +DEBUG = False VERBOSE = False FORCE = False SKIP = False @@ -74,13 +75,11 @@ FOLDER = { 'nvd' : os.path.join(FILEPATH, 'tmp', 'nvd') } - #TODO Deprecated logging.basicConfig(format='%(levelname)-6s[%(asctime)s] : %(message)s', datefmt='%H:%M:%S', level=logging.DEBUG) - #TODO Deprecated def debug(msg): - if VERBOSE: + if DEBUG: logging.debug(msg) @@ -629,7 +628,9 @@ def parse_cve_files(directory, kernel, best, arch): for item in os.listdir(directory): try: - files.append(read_cve_file(directory, item[:-4])) + cve_file = read_cve_file(directory, item[:-4]) + if cve_file is not None: + files.append(cve_file) except: #FIXME specify pass @@ -673,10 +674,13 @@ def read_cve_file(directory, bugid): affected = list() filename = os.path.join(directory, bugid + '.xml') - - with open(filename, 'r+') as xml_data: - memory_map = mmap.mmap(xml_data.fileno(), 0) - root = et.parse(memory_map).getroot() + + try: + with open(filename, 'r+') as xml_data: + memory_map = mmap.mmap(xml_data.fileno(), 0) + root = et.parse(memory_map).getroot() + except IOError: + return None bugroot = root.find('bug') |