mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-02-03 13:47:04 +03:00
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:
parent
05cc726731
commit
e79f68d11d
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user