is_ok = false;
}
unlock_dir(lock_fd);
- unlock_dir(cinfo->lock_fd);
-
- if (remove_dir(cinfo->temp_dir, 1) < 0)
- _E("Failed to delete temp directory");
-
- clean_temp(crash_temp_path);
return is_ok;
}
}
}
+static void crash_manager_cleanup(struct crash_info *cinfo)
+{
+ assert(cinfo);
+ unlock_dir(cinfo->lock_fd);
+
+ if (remove_dir(cinfo->temp_dir, 1) < 0)
+ _E("Failed to delete temp directory");
+
+ clean_temp(crash_temp_path);
+}
+
void crash_manager_free(struct crash_info *cinfo)
{
if (cinfo->prstatus_fd >= 0)
if (!crash_manager_prepare(cinfo))
return false;
- return run(cinfo);
+ bool result = run(cinfo);
+ crash_manager_cleanup(cinfo);
+
+ return result;
}
bool crash_manager_livedump_pid(pid_t pid, const char *dump_reason, char *report_path, size_t report_path_len)
write_dump_reason(dump_reason, cinfo.pfx, cinfo.name);
- if (!run(&cinfo))
+ result = run(&cinfo);
+ crash_manager_cleanup(&cinfo);
+
+ if (!result)
goto exit;
strncpy(report_path, cinfo.result_path, report_path_len);