summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--lib/MiddleWare/test.cpp2
-rw-r--r--lib/Utils/DebugDump.cpp13
-rw-r--r--lib/Utils/Makefile.am4
4 files changed, 14 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 6f6a2d4e..b507e97a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,6 +10,7 @@ AC_PROG_CXX
PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1])
PKG_CHECK_MODULES([SQLITE3], [sqlite3])
PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4])
+PKG_CHECK_MODULES([PACKAGEKIT_GLIB], [packagekit-glib])
AC_CHECK_HEADER([sys/inotify.h], [],
[AC_MSG_ERROR([sys/inotify.h is needed to build CrashCatcher])])
diff --git a/lib/MiddleWare/test.cpp b/lib/MiddleWare/test.cpp
index 9d54b0b7..b75bab94 100644
--- a/lib/MiddleWare/test.cpp
+++ b/lib/MiddleWare/test.cpp
@@ -45,8 +45,6 @@ int main(int argc, char** argv)
dd.SaveText(FILENAME_LANGUAGE, "CCpp");
dd.SaveBinary(FILENAME_BINARYDATA1, "ass0-9as", sizeof("ass0-9as"));
dd.SaveText(FILENAME_TIME, "1111111111");
- dd.SaveText(FILENAME_EXECUTABLE, "test");
- dd.SaveText(FILENAME_PACKAGE, "test-1.0-1.f10");
middleWare.SaveDebugDumpToDatabase(std::string(DEBUG_DUMPS_DIR)+"/"+pid);
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp
index e35ec4dd..9fd887fd 100644
--- a/lib/Utils/DebugDump.cpp
+++ b/lib/Utils/DebugDump.cpp
@@ -20,6 +20,7 @@
*/
#include "DebugDump.h"
+#include "Packages.h"
#include <fstream>
#include <iostream>
#include <sstream>
@@ -223,12 +224,20 @@ void CDebugDump::SaveProc(const std::string& pPID)
std::string path = "/proc/"+pPID+"/exe";
std::string data;
char executable[PATH_MAX];
+ int len;
- if (readlink(path.c_str(), executable, PATH_MAX) == 0)
+ if ((len = readlink(path.c_str(), executable, PATH_MAX)) != -1)
{
+ executable[len] = '\0';
SaveText(FILENAME_EXECUTABLE, executable);
}
+ CPackages packages;
+ while (!packages.SearchFile(executable)) {}
+ while (!packages.GetStatus()) {}
+ std::string package = packages.GetSearchFileReply();
+ SaveText(FILENAME_PACKAGE, package);
+
path = "/proc/"+pPID+"/status";
std::string uid = "0";
int ii = 0;
@@ -242,6 +251,4 @@ void CDebugDump::SaveProc(const std::string& pPID)
ii++;
}
SaveText(FILENAME_UID, uid);
-
- // TODO: Use packagekit
}
diff --git a/lib/Utils/Makefile.am b/lib/Utils/Makefile.am
index 71a8e98d..2b47b1ee 100644
--- a/lib/Utils/Makefile.am
+++ b/lib/Utils/Makefile.am
@@ -1,6 +1,8 @@
lib_LTLIBRARIES = libUtils.la
-libUtils_la_SOURCES = DebugDump.cpp DebugDump.h
+libUtils_la_SOURCES = DebugDump.cpp DebugDump.h Packages.cpp Packages.h
libUtils_la_LDFLAGS = -version-info 0:1:0
+libUtils_la_CPPFLAGS = $(PACKAGEKIT_GLIB_CFLAGS)
+libUtils_la_LIBADD = $(PACKAGEKIT_GLIB_LIBS)
install-data-local:
$(mkdir_p) '$(DEBUG_DUMPS_DIR)' \ No newline at end of file