diff options
| author | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-05-28 14:20:09 +0200 |
|---|---|---|
| committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-05-28 14:20:09 +0200 |
| commit | 012b25107c2b9cbc8d5ed37dd495d380bd74671f (patch) | |
| tree | 58e756f1035ce9d5535c1a414306f84e46c2d498 /lib/Utils/DebugDump.cpp | |
| parent | 3f914e8ea776aedb460fe0aade02f68c2e9be21d (diff) | |
| parent | 49fe5dd21d832c7a27739f2885b24dfa638b3244 (diff) | |
| download | abrt-012b25107c2b9cbc8d5ed37dd495d380bd74671f.tar.gz abrt-012b25107c2b9cbc8d5ed37dd495d380bd74671f.tar.xz abrt-012b25107c2b9cbc8d5ed37dd495d380bd74671f.zip | |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'lib/Utils/DebugDump.cpp')
| -rw-r--r-- | lib/Utils/DebugDump.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp index 1b7fbd1..0ac9d79 100644 --- a/lib/Utils/DebugDump.cpp +++ b/lib/Utils/DebugDump.cpp @@ -61,11 +61,11 @@ void CDebugDump::Open(const std::string& pDir) { throw CABRTException(EXCEP_ERROR, "CDebugDump::CDebugDump(): DebugDump is already opened."); } - m_sDebugDumpDir = pDir; + m_sDebugDumpDir = RemoveBackSlashes(pDir); std::string lockPath = m_sDebugDumpDir + "/.lock"; - if (!ExistFileDir(pDir)) + if (!ExistFileDir(m_sDebugDumpDir)) { - throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::CDebugDump(): "+pDir+" does not exist."); + throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::CDebugDump(): "+m_sDebugDumpDir+" does not exist."); } Lock(); m_bOpened = true; @@ -181,20 +181,20 @@ void CDebugDump::Create(const std::string& pDir) throw CABRTException(EXCEP_ERROR, "CDebugDump::CDebugDump(): DebugDump is already opened."); } - m_sDebugDumpDir = pDir; - std::string lockPath = pDir + ".lock"; - if (ExistFileDir(pDir)) + m_sDebugDumpDir = RemoveBackSlashes(pDir); + std::string lockPath = m_sDebugDumpDir + ".lock"; + if (ExistFileDir(m_sDebugDumpDir)) { - throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::CDebugDump(): "+pDir+" already exists."); + throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::CDebugDump(): "+m_sDebugDumpDir+" already exists."); } Lock(); m_bOpened = true; - if (mkdir(pDir.c_str(), 0755) == -1) + if (mkdir(m_sDebugDumpDir.c_str(), 0755) == -1) { UnLock(); - throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::Create(): Cannot create dir: " + pDir); + throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::Create():m_sDebugDumpDir Cannot create dir: " + pDir); } SaveKernelArchitectureRelease(); @@ -268,6 +268,16 @@ bool CDebugDump::IsTextFile(const std::string& pName) return isText; } +std::string CDebugDump::RemoveBackSlashes(const std::string& pDir) +{ + std::string ret = pDir; + while (ret[ret.length() - 1] == '/') + { + ret = ret.substr(0, ret.length() - 2); + } + return ret; +} + void CDebugDump::Delete() { if (!ExistFileDir(m_sDebugDumpDir)) |
