When power cut occurs or faultd is killed with -9 signal, database
doesn't close properly. In this situation faultd crashes during next
launch. This problem can be solved by removing
/var/db/faultd/faultdb_log.wal file before trying to open database
again.
Change-Id: Ibbc1ac1a618e8df19cf0e63667fe82207fdbb7b5
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
goto error;
}
+ /* when faultdb_log.wal file exists, ejdbopen() will cause segfault */
+ ret = access(DBDIR "/faultdb_log.wal", F_OK);
+ if (ret == 0) {
+ log_error("Database was not closed properly. "
+ "Removing faultdb_log.wal before opening database again");
+
+ ret = unlink(DBDIR "/faultdb_log.wal");
+ if (ret != 0) {
+ log_error_errno(errno, "Unable to remove faultdb_log.wal");
+ goto error;
+ }
+ }
+
if (!ejdbopen(da->db, DBDIR "/faultdb", JBOWRITER | JBOCREAT | JBOTSYNC)) {
log_error("ejdbopen has failed: %s", ejdberrmsg(ejdbecode(da->db)));
goto error;