summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 04811ff26b..ceee6f2c90 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -729,6 +729,8 @@ int is_kernel_thread(pid_t pid) {
int get_process_exe(pid_t pid, char **name) {
const char *p;
+ char *d;
+ int r;
assert(pid >= 0);
assert(name);
@@ -738,7 +740,15 @@ int get_process_exe(pid_t pid, char **name) {
else
p = procfs_file_alloca(pid, "exe");
- return readlink_malloc(p, name);
+ r = readlink_malloc(p, name);
+ if (r < 0)
+ return r;
+
+ d = endswith(*name, " (deleted)");
+ if (d)
+ *d = '\0';
+
+ return 0;
}
static int get_process_id(pid_t pid, const char *field, uid_t *uid) {