summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-06-29 13:11:44 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-07-02 23:06:22 -0400
commite79f68d11dcf4f7470fe21c219009c81e6433cf9 (patch)
tree9e5ccd281d44b649f702cbc0f63053b41eee574c /src
parent05cc726731c5cec952722f1c14acb08e3d4d5e98 (diff)
journald: drop (deleted) from _EXE= fields
The kernel adds those when the file is deleted, but we don't really care if the file is still there or not. The downside is that if the filename ends in ' (deleted)', this part of the filename will be removed. Too bad.
Diffstat (limited to 'src')
-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) {