summaryrefslogtreecommitdiffstats
path: root/lib/Utils/DebugDump.cpp
diff options
context:
space:
mode:
authorJiri Moskovcak <jmoskovc@redhat.com>2009-02-11 10:44:40 +0100
committerJiri Moskovcak <jmoskovc@redhat.com>2009-02-11 10:44:40 +0100
commit356da89a4e2e6e50ceade12f286d104fe1c17eae (patch)
tree1fafbfebd44b937eb63906453a285ad5a4b1558a /lib/Utils/DebugDump.cpp
parent3192f468fa5e7f10c664cca671246f962d1d36d1 (diff)
parent08ec10a5f6a2d6159e926cb075ad3eb4964ced50 (diff)
downloadabrt-356da89a4e2e6e50ceade12f286d104fe1c17eae.tar.gz
abrt-356da89a4e2e6e50ceade12f286d104fe1c17eae.tar.xz
abrt-356da89a4e2e6e50ceade12f286d104fe1c17eae.zip
Merge branch 'master' of git://git.fedorahosted.org/git/crash-catcher
Diffstat (limited to 'lib/Utils/DebugDump.cpp')
-rw-r--r--lib/Utils/DebugDump.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp
index 9fd887f..e0f88c4 100644
--- a/lib/Utils/DebugDump.cpp
+++ b/lib/Utils/DebugDump.cpp
@@ -32,6 +32,7 @@
#include <fcntl.h>
#include <sys/procfs.h>
#include <ctype.h>
+#include <time.h>
CDebugDump::CDebugDump() :
m_sDebugDumpDir("")
@@ -75,8 +76,16 @@ void CDebugDump::Create(const std::string& pDir)
throw "CDebugDump::Create(): Cannot create dir: " + pDir;
}
SaveEnvironment();
+ SaveTime();
}
+void CDebugDump::Create(const std::string& pDir, const std::string& pPID)
+{
+ Create(pDir);
+ SaveProc(pPID);
+}
+
+
void CDebugDump::Delete(const std::string& pDir)
{
if (!ExistFileDir(pDir))
@@ -122,6 +131,18 @@ void CDebugDump::SaveEnvironment()
}
}
+void CDebugDump::SaveTime()
+{
+ std::stringstream ss;
+ time_t t = time(NULL);
+ if (((time_t) -1) == t)
+ {
+ throw std::string("CDebugDump::SaveTime(): Cannot get local time.");
+ }
+ ss << t;
+ SaveText(FILENAME_TIME, ss.str());
+}
+
void CDebugDump::LoadTextFile(const std::string& pPath, std::string& pData)
{
std::ifstream fIn;
@@ -236,10 +257,11 @@ void CDebugDump::SaveProc(const std::string& pPID)
while (!packages.SearchFile(executable)) {}
while (!packages.GetStatus()) {}
std::string package = packages.GetSearchFileReply();
+
SaveText(FILENAME_PACKAGE, package);
path = "/proc/"+pPID+"/status";
- std::string uid = "0";
+ std::string uid = "";
int ii = 0;
LoadTextFile(path, data);