summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Moskovcak <jmoskovc@redhat.com>2010-06-03 16:25:51 +0200
committerJiri Moskovcak <jmoskovc@redhat.com>2010-06-03 16:25:51 +0200
commit2cd64dab084dd27fe6d9bf148ee3e9234c73b72a (patch)
treea151cca380b803f5e18bff84e2a0bbb94b8f37bb
parentb69e4c744b48ed2f70878ccd1535ab9fad2bd959 (diff)
downloadabrt-2cd64dab084dd27fe6d9bf148ee3e9234c73b72a.tar.gz
abrt-2cd64dab084dd27fe6d9bf148ee3e9234c73b72a.tar.xz
abrt-2cd64dab084dd27fe6d9bf148ee3e9234c73b72a.zip
remove "(deleted)" from executable path rhbz#593037
-rw-r--r--src/Hooks/abrt-hook-ccpp.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Hooks/abrt-hook-ccpp.cpp b/src/Hooks/abrt-hook-ccpp.cpp
index b72e8be8..d50f3cb3 100644
--- a/src/Hooks/abrt-hook-ccpp.cpp
+++ b/src/Hooks/abrt-hook-ccpp.cpp
@@ -137,7 +137,15 @@ static char* get_executable(pid_t pid)
char buf[sizeof("/proc/%lu/exe") + sizeof(long)*3];
sprintf(buf, "/proc/%lu/exe", (long)pid);
- return malloc_readlink(buf);
+ char *executable = malloc_readlink(buf);
+ /* find and cut off " (deleted)" from the path */
+ char *deleted = executable + strlen(executable) - strlen(" (deleted)");
+ if (deleted > executable && strcmp(deleted, " (deleted)") == 0)
+ {
+ *deleted = '\0';
+ log("file %s seems to be deleted", executable);
+ }
+ return executable;
}
static char* get_cwd(pid_t pid)