1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-01 08:58:29 +03:00

process-util: make use of delete_trailing_chars() in get_process_cmdline()

This commit is contained in:
Lennart Poettering 2018-06-06 11:58:18 +02:00
parent 1627069766
commit af8974940d

View File

@ -258,15 +258,10 @@ int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
memcpy(ans, "[...]", max_length-1); memcpy(ans, "[...]", max_length-1);
ans[max_length-1] = 0; ans[max_length-1] = 0;
} else { } else {
char *e;
t[max_length - 6] = 0; t[max_length - 6] = 0;
/* Chop off final spaces */ /* Chop off final spaces */
e = strchr(t, 0); delete_trailing_chars(t, WHITESPACE);
while (e > t && isspace(e[-1]))
e--;
*e = 0;
ans = strjoin("[", t, "...]"); ans = strjoin("[", t, "...]");
} }