summaryrefslogtreecommitdiffstats
path: root/lib/Utils/DebugDump.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-08-26 16:22:26 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-08-26 16:22:26 +0200
commitfca6fa371006186d12a720cd48c270789c67d2e6 (patch)
treebb17aaf2e00132d41263aac0fee6481d754800dd /lib/Utils/DebugDump.cpp
parent556a4b3df4f116965e8dc46c08ac5e720834022e (diff)
downloadabrt-fca6fa371006186d12a720cd48c270789c67d2e6.tar.gz
abrt-fca6fa371006186d12a720cd48c270789c67d2e6.tar.xz
abrt-fca6fa371006186d12a720cd48c270789c67d2e6.zip
replace comm_layer_inner_debug() with log() everywhere
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils/DebugDump.cpp')
-rw-r--r--lib/Utils/DebugDump.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp
index f63a8c6b..330e1cc9 100644
--- a/lib/Utils/DebugDump.cpp
+++ b/lib/Utils/DebugDump.cpp
@@ -19,26 +19,16 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "abrtlib.h"
-#include "DebugDump.h"
-#include "ABRTException.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <cerrno>
#include <sys/utsname.h>
#include <magic.h>
-
+#include "abrtlib.h"
+#include "DebugDump.h"
+#include "ABRTException.h"
#include "CommLayerInner.h"
-// BUG? in C/C++, compiler may assume that function address is never NULL
-#pragma weak comm_layer_inner_debug
-#define comm_layer_inner_debug(msg) ({\
- if (comm_layer_inner_debug)\
- {\
- comm_layer_inner_debug(msg);\
- }})
-
-#define PID_STR_MAX 16
/* Is it "." or ".."? */
/* abrtlib candidate */
@@ -112,7 +102,7 @@ bool CDebugDump::GetAndSetLock(const std::string& pLockFile, const std::string&
{
throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::GetAndSetLock(): cannot get lock status");
}
- char pid[PID_STR_MAX + 1];
+ char pid[sizeof(pid_t)*3 + 4];
int r = read(fd, pid, sizeof(pid) - 1);
if (r == -1)
{
@@ -124,7 +114,7 @@ bool CDebugDump::GetAndSetLock(const std::string& pLockFile, const std::string&
{
close(fd);
m_bUnlock = false;
- comm_layer_inner_debug("Lock file '"+pLockFile+"' is locked by same process");
+ log("Lock file '%s' is locked by same process", pLockFile.c_str());
return true;
}
if (lockf(fd, F_TEST, 0) == 0)
@@ -134,7 +124,7 @@ bool CDebugDump::GetAndSetLock(const std::string& pLockFile, const std::string&
Delete();
throw CABRTException(EXCEP_ERROR, "CDebugDump::GetAndSetLock(): dead lock found");
}
- comm_layer_inner_debug("Lock file '"+pLockFile+"' is locked by another process");
+ log("Lock file '%s' is locked by another process", pLockFile.c_str());
close(fd);
return false;
}
@@ -154,7 +144,7 @@ bool CDebugDump::GetAndSetLock(const std::string& pLockFile, const std::string&
m_nFD = fd;
m_bUnlock = true;
- comm_layer_inner_debug("Locking '"+pLockFile+"'...");
+ log("Locking '%s'...", pLockFile.c_str());
return true;
}
@@ -176,7 +166,7 @@ void CDebugDump::UnLock()
std::string lockFile = m_sDebugDumpDir + ".lock";
if (m_bUnlock)
{
- comm_layer_inner_debug("UnLocking '"+lockFile+"'...");
+ log("UnLocking '%s'...", lockFile.c_str());
close(m_nFD);
m_nFD = -1;
remove(lockFile.c_str());