From 8a163407875f2c73258e7f968b8f1e2d7f50a72c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 25 Jul 2009 03:34:31 +0200 Subject: Be more paranoid about /proc/.../core_pattern Signed-off-by: Denys Vlasenko --- lib/Plugins/CCpp.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib/Plugins') diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index fe6c56ca..47bfceba 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -534,6 +534,23 @@ void CAnalyzerCCpp::Init() getline(fInCorePattern, m_sOldCorePattern); fInCorePattern.close(); } + if (m_sOldCorePattern[0] == '|') + { + if (m_sOldCorePattern == CORE_PATTERN) + { + fprintf(stderr, "warning: %s already contains %s, " + "did abrt daemon crash recently?\n", + CORE_PATTERN_IFACE, CORE_PATTERN); + /* There is no point in "restoring" CORE_PATTERN_IFACE + * to CORE_PATTERN on exit. Will restore to a default value: + */ + m_sOldCorePattern = "core"; + } + fprintf(stderr, "warning: %s was already set to run a crash analyser (%s), " + "abrt may interfere with it\b", + CORE_PATTERN_IFACE, CORE_PATTERN); + } + std::ofstream fOutCorePattern; fOutCorePattern.open(CORE_PATTERN_IFACE); if (fOutCorePattern.is_open()) -- cgit