summaryrefslogtreecommitdiffstats
path: root/lib/Utils
diff options
context:
space:
mode:
authorZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-04-28 17:08:09 +0200
committerZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-04-28 17:08:09 +0200
commit2e6a6e8aed825e456600d01c8a805b6f6fd24c3a (patch)
treec58cba2913350fed9674813b3fe0a27e6639fbd2 /lib/Utils
parentb08d5c2cf630ecb89d2f22b985dcdfcf25494258 (diff)
downloadabrt-2e6a6e8aed825e456600d01c8a805b6f6fd24c3a.tar.gz
abrt-2e6a6e8aed825e456600d01c8a805b6f6fd24c3a.tar.xz
abrt-2e6a6e8aed825e456600d01c8a805b6f6fd24c3a.zip
new commlayerinner interface
Diffstat (limited to 'lib/Utils')
-rw-r--r--lib/Utils/DebugDump.cpp16
-rw-r--r--lib/Utils/Makefile.am1
2 files changed, 12 insertions, 5 deletions
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp
index 8dd3114..421deb6 100644
--- a/lib/Utils/DebugDump.cpp
+++ b/lib/Utils/DebugDump.cpp
@@ -100,12 +100,14 @@ bool CDebugDump::GetAndSetLock(const std::string& pLockFile, const std::string&
getline(fIn, line);
if (line == pPID)
{
+ fIn.close();
m_bUnlock = false;
return true;
}
ss << "/proc/" << line << "/";
if (!ExistFileDir(ss.str()))
{
+ fIn.close();
remove(pLockFile.c_str());
Delete();
throw CABRTException(EXCEP_ERROR, "CDebugDump::GetAndSetLock(): dead lock found");
@@ -117,17 +119,21 @@ bool CDebugDump::GetAndSetLock(const std::string& pLockFile, const std::string&
void CDebugDump::Lock()
{
- std::string lockPath = m_sDebugDumpDir + ".lock";
+ int ii = 0;
+ std::string lockFile = m_sDebugDumpDir + ".lock";
pid_t nPID = getpid();
std::stringstream ss;
ss << nPID;
- std::cerr << "CDebugDump::Lock(): waiting...";
- while (!GetAndSetLock(lockPath, ss.str()))
+ while (!GetAndSetLock(lockFile, ss.str()))
{
- std::cerr << ".";
usleep(5000);
+ // 40000 is about 20s, that should be enough.
+ if (ii > 40000)
+ {
+ throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::Lock(): timeout occurs when opening '"+m_sDebugDumpDir+"'");
+ }
+ ii++;
}
- std::cerr << "done." << std::endl;
}
void CDebugDump::UnLock()
diff --git a/lib/Utils/Makefile.am b/lib/Utils/Makefile.am
index a5c35f3..c873920 100644
--- a/lib/Utils/Makefile.am
+++ b/lib/Utils/Makefile.am
@@ -2,6 +2,7 @@ lib_LTLIBRARIES = libABRTUtils.la
libABRTUtils_la_SOURCES = DebugDump.cpp DebugDump.h
libABRTUtils_la_LDFLAGS = -version-info 0:1:0
libABRTUtils_la_LIBADD = -lmagic
+libABRTUtils_la_CPPFLAGS = -I$(srcdir)/../../inc
install-data-local:
$(mkdir_p) '$(DESTDIR)/$(DEBUG_DUMPS_DIR)' \ No newline at end of file