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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2013-06-29 13:11:44 -04:00
parent 05cc726731
commit e79f68d11d

View file

@ -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) {