[igt-dev] [PATCH i-g-t] runner: Chomp away trailing spaces from cmdline

Chris Wilson chris at chris-wilson.co.uk
Tue Sep 24 09:19:43 UTC 2019


A minor refinement to remove the trailing spaces after converting the
NUL-terminators to spaces.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Petri Latvala <petri.latvala at intel.com>
---
 runner/executor.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/runner/executor.c b/runner/executor.c
index 3e0121421..130ba38d2 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -630,6 +630,10 @@ static const char *get_cmdline(pid_t pid, char *buf, ssize_t len)
 		if (buf[i] == '\0')
 			buf[i] = ' ';
 
+	/* chomp away the trailing spaces */
+	while (buf[len - 1] == ' ')
+		--len;
+
 	buf[len] = '\0'; /* but make sure that we return a valid string! */
 	return buf;
 }
-- 
2.23.0



More information about the igt-dev mailing list