[PATCH igt 4/9] msm/mapping: Handle BO names with spaces
Rob Clark
robin.clark at oss.qualcomm.com
Mon Jun 30 18:08:58 UTC 2025
From: Rob Clark <rob.clark at oss.qualcomm.com>
Instead of trimming at the first space, scan from the end of the string
until we reach the first non-space char.
Signed-off-by: Rob Clark <rob.clark at oss.qualcomm.com>
---
tests/msm/msm_mapping.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/msm/msm_mapping.c b/tests/msm/msm_mapping.c
index f536db82aba2..5afbcd081fc7 100644
--- a/tests/msm/msm_mapping.c
+++ b/tests/msm/msm_mapping.c
@@ -101,13 +101,14 @@ endswith(const char *str, const char *end)
/* Trim trailing whitespace: */
if (p) {
- char *c = p;
- while (c) {
+ char *c = p + strlen(p) - 1;
+ while (c > p ) {
if (isspace(*c)) {
*c = '\0';
+ } else {
break;
}
- c++;
+ c--;
}
}
--
2.50.0
More information about the igt-dev
mailing list