summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2009-12-03 16:08:25 +0100
committerKarel Klic <kklic@redhat.com>2009-12-03 16:08:25 +0100
commitfe973ec6d72c207a5f98077068da804c360759ad (patch)
tree3c9fbfccd5ec68e237b289b68d638f74eff724b2 /lib
parent8a277c2828ffe29526e4d6df29af6c69809e5efa (diff)
downloadabrt-fe973ec6d72c207a5f98077068da804c360759ad.tar.gz
abrt-fe973ec6d72c207a5f98077068da804c360759ad.tar.xz
abrt-fe973ec6d72c207a5f98077068da804c360759ad.zip
abrt-backtrace called with bt file path
Diffstat (limited to 'lib')
-rw-r--r--lib/Plugins/CCpp.cpp32
1 files changed, 8 insertions, 24 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index b951b110..c8889ac3 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -539,14 +539,13 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir)
{
log(_("Getting global universal unique identification..."));
- string backtrace;
+ string backtrace_path = (string)pDebugDumpDir + "/" + FILENAME_BACKTRACE;
string executable;
string package;
string uid_str;
{
CDebugDump dd;
dd.Open(pDebugDumpDir);
- dd.LoadText(FILENAME_BACKTRACE, backtrace);
dd.LoadText(FILENAME_EXECUTABLE, executable);
dd.LoadText(FILENAME_PACKAGE, package);
dd.LoadText(FILENAME_UID, uid_str);
@@ -554,12 +553,13 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir)
/* Run abrt-backtrace to get independent backtrace suitable
to UUID calculation. */
- char *args[5];
+ char *args[6];
args[0] = (char*)"abrt-backtrace";
args[1] = (char*)"--single-thread";
args[2] = (char*)"--remove-exit-handlers";
args[3] = (char*)"--frame-depth=5";
- args[4] = NULL;
+ args[4] = (char*)backtrace_path.c_str();
+ args[5] = NULL;
uid_t uid = atoi(uid_str.c_str());
gid_t gid = uid;
@@ -567,8 +567,7 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir)
if (pw)
gid = pw->pw_gid;
- int pipein[2], pipeout[2];
- xpipe(pipein); /* stdin of abrt-backtrace */
+ int pipeout[2];
xpipe(pipeout); /* stdout of abrt-backtrace */
pid_t child = fork();
if (child == -1)
@@ -576,10 +575,7 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir)
if (child == 0)
{
VERB1 log("Executing: %s", concat_str_vector(args).c_str());
- /* Attach proper ends of pipes to stdin and stdout,
- close the other ones. */
- xmove_fd(pipein[0], STDIN_FILENO);
- close(pipein[1]); /* write side of the pipe */
+
xmove_fd(pipeout[1], STDOUT_FILENO);
close(pipeout[0]); /* read side of the pipe */
@@ -595,20 +591,8 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir)
exit(1);
}
- close(pipein[0]); /* read side of the pipe */
close(pipeout[1]); /* write side of the pipe */
- /* Send the backtrace to abrt-backtrace program. */
- size_t len = backtrace.length();
- ssize_t result = write(pipein[1], backtrace.c_str(), len);
- if (result != len)
- {
- perror_msg_and_die("Unable to write %d bytes to pipe, "
- " returned value is %d",
- (int)len, (int)result);
- }
- close(pipein[1]);
-
/* Read the result from abrt-backtrace. */
int r;
char buff[1024];
@@ -631,8 +615,8 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir)
int exit_status = WEXITSTATUS(status);
if (exit_status > 0 && exit_status <= EX__MAX)
{
- perror_msg_and_die("abrt-backtrace run failed, exit value: %d",
- exit_status);
+ error_msg_and_die("abrt-backtrace run failed, exit value: %d",
+ exit_status);
}
/*VERB1 log("abrt-backtrace result: %s", independent_backtrace.c_str());*/