diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-12-05 19:25:40 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-12-07 08:44:18 -0500 |
commit | 90bc76956c1a6cd29a9120a4bafa3bbdfe39f428 (patch) | |
tree | f34fe4a10d169d3c08a6de1cc57855df11045247 | |
parent | f3b522cac6b2fbbed25ce8781058de0eea916282 (diff) | |
download | rockbox-90bc76956c.tar.gz rockbox-90bc76956c.zip |
Ignore trailing whitespace in settings .cfg files
Have settings_parseline() strip trailing whitespace from
the setting value.
Fixes a regression introduced by 5b1dd64f5, which caused
filename settings to be parsed incorrectly when there is
trailing whitespace in the .cfg file.
Change-Id: I6c54428f6467ea2d169d2a7449705b40627e1a40
-rw-r--r-- | apps/misc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/misc.c b/apps/misc.c index 327dc5802d..63a3a2a6eb 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -272,6 +272,15 @@ bool settings_parseline(char* line, char** name, char** value) ptr++; ptr = skip_whitespace(ptr); *value = ptr; + + /* strip whitespace from the right side of value */ + ptr += strlen(ptr); + for (ptr--; ptr >= *value; ptr--) + { + if (isspace(*ptr)) + *ptr = '\0'; + } + return true; } |