Fix issue #228.
Also add use cases to simulation test environment.
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
FILE *fp;
char filename[128], line[MAX_CMDLINE_LEN];
size_t len;
- int i;
+ int i, found = FALSE;
if (tgid) {
sprintf(filename, TASK_CMDLINE, tgid, pid);
fclose(fp);
if (len) {
- for (i = 0; i < len - 1; i++) {
- if (line[i] == '\0') {
+ for (i = len - 2; i >= 0; i--) {
+ if (line[i]) {
+ found = TRUE;
+ }
+ else if (found) {
line[i] = ' ';
}
}