From f48e217149c36a49cb64221bfca752c53d8c1bee Mon Sep 17 00:00:00 2001 From: Zdenek Prikryl Date: Thu, 5 Feb 2009 19:21:41 +0100 Subject: DebugDump can get package name now --- lib/Utils/DebugDump.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/Utils/DebugDump.cpp') diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp index e35ec4d..9fd887f 100644 --- a/lib/Utils/DebugDump.cpp +++ b/lib/Utils/DebugDump.cpp @@ -20,6 +20,7 @@ */ #include "DebugDump.h" +#include "Packages.h" #include #include #include @@ -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 } -- cgit