diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-09 19:04:42 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-09 19:04:42 +0200 |
commit | 39d77b6cfa633b94a31de5ec387949a7c7b85623 (patch) | |
tree | 37dbbb2f84ff2e8d524cdf8ece16401e8955d6dd /lib/Utils/DebugDump.cpp | |
parent | 08ec5a72cd334fffc8aa343ab48f4b6d1c88e3a7 (diff) | |
download | abrt-39d77b6cfa633b94a31de5ec387949a7c7b85623.tar.gz abrt-39d77b6cfa633b94a31de5ec387949a7c7b85623.tar.xz abrt-39d77b6cfa633b94a31de5ec387949a7c7b85623.zip |
fix the bug where lock file was not removed
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils/DebugDump.cpp')
-rw-r--r-- | lib/Utils/DebugDump.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp index 6eb58369..03fb7c64 100644 --- a/lib/Utils/DebugDump.cpp +++ b/lib/Utils/DebugDump.cpp @@ -48,6 +48,7 @@ static bool isdigit_str(const char *str) if (*str < '0' || *str > '9') return false; str++; } + return true; } static std::string RemoveBackSlashes(const std::string& pDir); @@ -105,6 +106,7 @@ static int GetAndSetLock(const char* pLockFile, const char* pPID) if (errno != EEXIST) perror_msg_and_die("Can't create lock file '%s'", pLockFile); fd = open(pLockFile, O_RDONLY); +log("opened O_RDONLY: '%s'", pLockFile); if (fd < 0) { if (errno == ENOENT) @@ -123,6 +125,7 @@ static int GetAndSetLock(const char* pLockFile, const char* pPID) continue; } pid_buf[r] = '\0'; +log("read: '%s'", pid_buf); if (strcmp(pid_buf, pPID) == 0) { log("Lock file '%s' is already locked by us", pLockFile); @@ -140,6 +143,7 @@ static int GetAndSetLock(const char* pLockFile, const char* pPID) /* The file may be deleted by now by other process. Ignore errors */ unlink(pLockFile); } +log("created O_EXCL: '%s'", pLockFile); int len = strlen(pPID); if (write(fd, pPID, len) != len) @@ -304,6 +308,11 @@ void CDebugDump::Delete() void CDebugDump::Close() { UnLock(); + if (m_pGetNextFileDir != NULL) + { + closedir(m_pGetNextFileDir); + m_pGetNextFileDir = NULL; + } m_bOpened = false; } |