Skip to content

Commit

Permalink
Merge pull request #69 from cuviper/wexitstatus-int
Browse files Browse the repository at this point in the history
Truncate PTRACE_GETEVENTMSG exit status to int
  • Loading branch information
wrwilliams committed Jun 1, 2016
2 parents 6e3a1f9 + 5d2e0b7 commit 1da0a1a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions proccontrol/src/linux.C
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,9 @@ bool DecoderLinux::decode(ArchEvent *ae, std::vector<Event::ptr> &events)
proc->getPid(), thread->getLWP());
if (thread->getLWP() == proc->getPid())
{
unsigned long exitcode = 0x0;
unsigned long eventmsg = 0x0;
int result = do_ptrace((pt_req)PTRACE_GETEVENTMSG, (pid_t) thread->getLWP(),
NULL, &exitcode);
NULL, &eventmsg);
if(result == -1)
{
int error = errno;
Expand All @@ -441,9 +441,10 @@ bool DecoderLinux::decode(ArchEvent *ae, std::vector<Event::ptr> &events)
proc->setLastError(err_exited, "Process exited during operation");
return false;
}
int exitcode = (int)eventmsg;
exitcode = WEXITSTATUS(exitcode);

pthrd_printf("Decoded event to pre-exit of process %d/%d with code %lu\n",
pthrd_printf("Decoded event to pre-exit of process %d/%d with code %i\n",
proc->getPid(), thread->getLWP(), exitcode);
event = Event::ptr(new EventExit(EventType::Pre, exitcode));

Expand Down

0 comments on commit 1da0a1a

Please sign in to comment.