summaryrefslogtreecommitdiffstats
path: root/lib/plugins
diff options
context:
space:
mode:
authorNikola Pajkovsky <npajkovs@redhat.com>2010-09-22 12:02:02 +0200
committerNikola Pajkovsky <npajkovs@redhat.com>2010-09-22 12:54:41 +0200
commitfe34bea3225ddf49f4611299af7b54c6ac60fbb6 (patch)
tree83e92bb81108b8fd7741d5a5bdcb40d0adf3ba34 /lib/plugins
parent5cba622bac75cd90a846a028e47245a16043da17 (diff)
downloadabrt-fe34bea3225ddf49f4611299af7b54c6ac60fbb6.tar.gz
abrt-fe34bea3225ddf49f4611299af7b54c6ac60fbb6.tar.xz
abrt-fe34bea3225ddf49f4611299af7b54c6ac60fbb6.zip
add two flags to dd_opendir()
DD_CLOSE_ON_OPEN_ERR - free dump_dir structure when opening dump_dir does not exist DD_FAIL_QUIETLY - suppress message when dump directory does not exist VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir); is all removed because there is error_msg("'%s' does not exist", dd->dd_dir); in dd_opendir() which sometimes we don't want to print(DD_FAIL_QUIETLY) example: crash dump directory trimming code running concurrently. Second process may try to delete a directory which is already gone. it should not complain that it is missing. Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com> Acked-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'lib/plugins')
-rw-r--r--lib/plugins/CCpp.cpp28
-rw-r--r--lib/plugins/Kerneloops.cpp6
-rw-r--r--lib/plugins/Python.cpp6
-rw-r--r--lib/plugins/RunApp.cpp6
-rw-r--r--lib/plugins/SOSreport.cpp6
5 files changed, 9 insertions, 43 deletions
diff --git a/lib/plugins/CCpp.cpp b/lib/plugins/CCpp.cpp
index c4a1f08c..041c85b8 100644
--- a/lib/plugins/CCpp.cpp
+++ b/lib/plugins/CCpp.cpp
@@ -209,12 +209,8 @@ static void GetIndependentBuildIdPC(const char *unstrip_n_output,
static char* run_unstrip_n(const char *pDebugDumpDir, unsigned timeout_sec)
{
struct dump_dir *dd = dd_init();
- if (!dd_opendir(dd, pDebugDumpDir))
- {
- dd_close(dd);
- VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir);
+ if (!dd_opendir(dd, pDebugDumpDir, DD_CLOSE_ON_OPEN_ERR))
return NULL;
- }
char *uid = dd_load_text(dd, CD_UID);
dd_close(dd);
@@ -403,12 +399,8 @@ static void trim_debuginfo_cache(unsigned max_mb)
string CAnalyzerCCpp::GetLocalUUID(const char *pDebugDumpDir)
{
struct dump_dir *dd = dd_init();
- if (!dd_opendir(dd, pDebugDumpDir))
- {
- dd_close(dd);
- VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir);
+ if (!dd_opendir(dd, pDebugDumpDir, DD_CLOSE_ON_OPEN_ERR))
return string("");
- }
char *executable = dd_load_text(dd, FILENAME_EXECUTABLE);
char *package = dd_load_text(dd, FILENAME_PACKAGE);
@@ -464,12 +456,8 @@ string CAnalyzerCCpp::GetLocalUUID(const char *pDebugDumpDir)
string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir)
{
struct dump_dir *dd = dd_init();
- if (!dd_opendir(dd, pDebugDumpDir))
- {
- dd_close(dd);
- VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir);
+ if (!dd_opendir(dd, pDebugDumpDir, DD_CLOSE_ON_OPEN_ERR))
return string("");
- }
if (dd_exist(dd, FILENAME_GLOBAL_UUID))
{
@@ -640,12 +628,8 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force)
}
struct dump_dir *dd = dd_init();
- if (!dd_opendir(dd, pDebugDumpDir))
- {
- dd_close(dd);
- VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir);
+ if (!dd_opendir(dd, pDebugDumpDir, DD_CLOSE_ON_OPEN_ERR))
return;
- }
if (!force)
{
@@ -688,11 +672,9 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force)
gen_backtrace(pDebugDumpDir, m_sDebugInfoDirs.c_str(), m_nGdbTimeoutSec);
dd = dd_init();
- if (!dd_opendir(dd, pDebugDumpDir))
+ if (!dd_opendir(dd, pDebugDumpDir, DD_CLOSE_ON_OPEN_ERR))
{
- dd_close(dd);
free(build_ids);
- VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir);
return;
}
diff --git a/lib/plugins/Kerneloops.cpp b/lib/plugins/Kerneloops.cpp
index 0c4b1a56..d3ce2e8b 100644
--- a/lib/plugins/Kerneloops.cpp
+++ b/lib/plugins/Kerneloops.cpp
@@ -126,12 +126,8 @@ std::string CAnalyzerKerneloops::GetLocalUUID(const char *pDebugDumpDir)
VERB3 log("Getting local universal unique identification");
struct dump_dir *dd = dd_init();
- if (!dd_opendir(dd, pDebugDumpDir))
- {
- dd_close(dd);
- VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir);
+ if (!dd_opendir(dd, pDebugDumpDir, DD_CLOSE_ON_OPEN_ERR))
return std::string("");
- }
char *oops = dd_load_text(dd, FILENAME_BACKTRACE);
unsigned hash = hash_oops_str(oops);
diff --git a/lib/plugins/Python.cpp b/lib/plugins/Python.cpp
index 9ef830e3..5e4cc02a 100644
--- a/lib/plugins/Python.cpp
+++ b/lib/plugins/Python.cpp
@@ -26,12 +26,8 @@ using namespace std;
string CAnalyzerPython::GetLocalUUID(const char *pDebugDumpDir)
{
struct dump_dir *dd = dd_init();
- if (!dd_opendir(dd, pDebugDumpDir))
- {
- dd_close(dd);
- VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir);
+ if (!dd_opendir(dd, pDebugDumpDir, DD_CLOSE_ON_OPEN_ERR))
return string("");
- }
char *bt = dd_load_text(dd, FILENAME_BACKTRACE);
dd_close(dd);
diff --git a/lib/plugins/RunApp.cpp b/lib/plugins/RunApp.cpp
index 0bf5ff0c..3ae6638b 100644
--- a/lib/plugins/RunApp.cpp
+++ b/lib/plugins/RunApp.cpp
@@ -58,12 +58,8 @@ void CActionRunApp::Run(const char *pActionDir, const char *pArgs, int force)
if (args.size() > FILENAME)
{
struct dump_dir *dd = dd_init();
- if (!dd_opendir(dd, pActionDir))
- {
- dd_close(dd);
- VERB1 log(_("Unable to open debug dump '%s'"), pActionDir);
+ if (!dd_opendir(dd, pActionDir, DD_CLOSE_ON_OPEN_ERR))
return;
- }
dd_save_binary(dd, args[FILENAME].c_str(), cmd_out, cmd_out_size);
dd_close(dd);
diff --git a/lib/plugins/SOSreport.cpp b/lib/plugins/SOSreport.cpp
index 280738d2..5c1b658a 100644
--- a/lib/plugins/SOSreport.cpp
+++ b/lib/plugins/SOSreport.cpp
@@ -51,12 +51,8 @@ void CActionSOSreport::Run(const char *pActionDir, const char *pArgs, int force)
if (!force)
{
struct dump_dir *dd = dd_init();
- if (!dd_opendir(dd, pActionDir))
- {
- dd_close(dd);
- VERB1 log(_("Unable to open debug dump '%s'"), pActionDir);
+ if (!dd_opendir(dd, pActionDir, DD_CLOSE_ON_OPEN_ERR))
return;
- }
bool bt_exists = dd_exist(dd, "sosreport.tar.bz2") || dd_exist(dd, "sosreport.tar.xz");
if (bt_exists)