summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2010-07-14 14:22:45 +0200
committerKarel Klic <kklic@redhat.com>2010-07-14 14:22:45 +0200
commit3c74aac425877adf2f8fe34cafa7c3eb69e11f04 (patch)
tree654b1859ea986f218dc8161d38b2cdda4b7641f8 /src
parent2016e4336301a76b72d4d2965c669caa26458812 (diff)
downloadabrt-3c74aac425877adf2f8fe34cafa7c3eb69e11f04.tar.gz
abrt-3c74aac425877adf2f8fe34cafa7c3eb69e11f04.tar.xz
abrt-3c74aac425877adf2f8fe34cafa7c3eb69e11f04.zip
Die with an error message if the database plugin is not accessible when needed.
Diffstat (limited to 'src')
-rw-r--r--src/Daemon/MiddleWare.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp
index b06d1985..91fb3f58 100644
--- a/src/Daemon/MiddleWare.cpp
+++ b/src/Daemon/MiddleWare.cpp
@@ -563,15 +563,20 @@ report_status_t Report(const map_crash_data_t& client_report,
/**
* Check whether particular debugdump directory is saved
* in database. This check is done together with an UID of an user.
- * @param pUID an UID of an user.
- * @param pDebugDumpDir A debugdump dir containing all necessary data.
- * @return It returns true if debugdump dir is already saved, otherwise
- * it returns false.
+ * @param uid
+ * An UID of an user.
+ * @param debug_dump_dir
+ * A debugdump dir containing all necessary data.
+ * @return
+ * It returns true if debugdump dir is already saved, otherwise
+ * it returns false.
+ * @todo
+ * Use database query instead of dumping all rows and searching in them.
*/
-static bool IsDebugDumpSaved(long uid,
- const char *pDebugDumpDir)
+static bool is_debug_dump_saved(long uid, const char *debug_dump_dir)
{
- /* TODO: use database query instead of dumping all rows and searching in them */
+ if (g_settings_sDatabase.empty())
+ error_msg_and_die(_("Database plugin not specified. Please check abrtd settings."));
CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase.c_str());
database->Connect();
@@ -582,7 +587,7 @@ static bool IsDebugDumpSaved(long uid,
bool found = false;
for (ii = 0; ii < rows.size(); ii++)
{
- if (rows[ii].m_sDebugDumpDir == pDebugDumpDir)
+ if (0 == strcmp(rows[ii].m_sDebugDumpDir.c_str(), debug_dump_dir))
{
found = true;
break;
@@ -982,7 +987,7 @@ static mw_result_t SaveDebugDumpToDatabase(const char *crash_id,
}
mw_result_t SaveDebugDump(const char *pDebugDumpDir,
- map_crash_data_t& pCrashData)
+ map_crash_data_t& pCrashData)
{
std::string UID;
std::string time;
@@ -1024,16 +1029,12 @@ mw_result_t SaveDebugDump(const char *pDebugDumpDir,
return MW_ERROR;
}
- if (IsDebugDumpSaved(uid_num, pDebugDumpDir))
- {
+ if (is_debug_dump_saved(uid_num, pDebugDumpDir))
return MW_IN_DB;
- }
mw_result_t res = SavePackageDescriptionToDebugDump(executable.c_str(), cmdline.c_str(), remote, pDebugDumpDir);
if (res != MW_OK)
- {
return res;
- }
std::string UUID = GetLocalUUID(analyzer.c_str(), pDebugDumpDir);
std::string crash_id = ssprintf("%s:%s", UID.c_str(), UUID.c_str());