diff --git a/lib/core/dump.py b/lib/core/dump.py index b4c8f341d..bfab601dd 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -79,6 +79,7 @@ class Dump: self._outputBP = StringIO.StringIO() def getOutputFile(self): + self.flush() return self._outputFile def string(self, header, data, sort=True): diff --git a/lib/utils/hashdb.py b/lib/utils/hashdb.py index ae0a716a7..71434a2e3 100644 --- a/lib/utils/hashdb.py +++ b/lib/utils/hashdb.py @@ -10,6 +10,7 @@ See the file 'doc/COPYING' for copying permission import hashlib import sqlite3 import threading +import time from lib.core.common import serializeObject from lib.core.common import unserializeObject @@ -101,8 +102,10 @@ class HashDB(object): except sqlite3.IntegrityError: self.cursor.execute("UPDATE storage SET value=? WHERE id=?", (value, hash_,)) except sqlite3.OperationalError, ex: - if not 'locked' in ex.message: + if not any(_ in ex.message for _ in ('locked', 'I/O')): raise + else: + time.sleep(1) else: break finally: