|
|
baab13 |
From 80d2c8604e4dae2fccad721eae0b219376a6ffce Mon Sep 17 00:00:00 2001
|
|
|
baab13 |
From: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
baab13 |
Date: Thu, 21 Apr 2016 11:20:40 +0200
|
|
|
baab13 |
Subject: [PATCH] ccpp: exit with error if cannot get executable
|
|
|
baab13 |
|
|
|
baab13 |
Related to rhbz#1277849
|
|
|
baab13 |
|
|
|
baab13 |
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
baab13 |
---
|
|
|
baab13 |
src/hooks/abrt-hook-ccpp.c | 11 +++++++++--
|
|
|
baab13 |
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
baab13 |
|
|
|
baab13 |
diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c
|
|
|
baab13 |
index c9fbf68..8afd0d3 100644
|
|
|
baab13 |
--- a/src/hooks/abrt-hook-ccpp.c
|
|
|
baab13 |
+++ b/src/hooks/abrt-hook-ccpp.c
|
|
|
baab13 |
@@ -703,13 +703,16 @@ static void error_msg_not_process_crash(const char *pid_str, const char *process
|
|
|
baab13 |
char *message_full = xvasprintf(message, p);
|
|
|
baab13 |
va_end(p);
|
|
|
baab13 |
|
|
|
baab13 |
+ char *process_name = (process_str) ? xasprintf(" (%s)", process_str) : xstrdup("");
|
|
|
baab13 |
+
|
|
|
baab13 |
if (signame)
|
|
|
baab13 |
error_msg("Process %s (%s) of user %lu killed by SIG%s - %s", pid_str,
|
|
|
baab13 |
- process_str, uid, signame, message_full);
|
|
|
baab13 |
+ process_name, uid, signame, message_full);
|
|
|
baab13 |
else
|
|
|
baab13 |
error_msg("Process %s (%s) of user %lu killed by signal %d - %s", pid_str,
|
|
|
baab13 |
- process_str, uid, signal_no, message_full);
|
|
|
baab13 |
+ process_name, uid, signal_no, message_full);
|
|
|
baab13 |
|
|
|
baab13 |
+ free(process_name);
|
|
|
baab13 |
free(message_full);
|
|
|
baab13 |
|
|
|
baab13 |
return;
|
|
|
baab13 |
@@ -835,6 +838,10 @@ int main(int argc, char** argv)
|
|
|
baab13 |
|
|
|
baab13 |
int src_fd_binary = -1;
|
|
|
baab13 |
char *executable = get_executable(pid, setting_SaveBinaryImage ? &src_fd_binary : NULL);
|
|
|
baab13 |
+ if (executable == NULL)
|
|
|
baab13 |
+ error_msg_not_process_crash(pid_str, NULL, (long unsigned)uid, signal_no,
|
|
|
baab13 |
+ signame, "ignoring (can't read /proc/PID/exe link)");
|
|
|
baab13 |
+
|
|
|
baab13 |
if (executable && strstr(executable, "/abrt-hook-ccpp"))
|
|
|
baab13 |
{
|
|
|
baab13 |
error_msg_and_die("PID %lu is '%s', not dumping it to avoid recursion",
|
|
|
baab13 |
--
|
|
|
baab13 |
1.8.3.1
|
|
|
baab13 |
|