summaryrefslogtreecommitdiff
path: root/runner/settings.c
diff options
context:
space:
mode:
authorLyude Paul <lyude@redhat.com>2020-06-10 12:04:17 -0400
committerLyude Paul <lyude@redhat.com>2020-06-11 13:02:31 -0400
commita8c256b4feb90201c727d72c168288a676c9d6ef (patch)
tree42b7659286088e04fd754d5234a461ce80131ca7 /runner/settings.c
parentc33471b4aa0a0ae9dd42202048e7037a661e0574 (diff)
runner: Fix handling of metadata values containing spaces
Noticed while running some tests that adding any kind of spaces into the name of a test run would stop igt_resume from working for said test run. Turns out that when we parse test metadata, we accidentally use the '%ms' specifier with fscanf() which finishes parsing strings when any kind of whitespace is encountered. So, fix this by using the proper %m[^\n] specifier, which dynamically allocates it's result and doesn't stop reading the string until a newline is encountered. Additionally, add a test for this. Signed-off-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'runner/settings.c')
-rw-r--r--runner/settings.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/runner/settings.c b/runner/settings.c
index d18e55d1..25f248ef 100644
--- a/runner/settings.c
+++ b/runner/settings.c
@@ -679,7 +679,7 @@ bool read_settings_from_file(struct settings *settings, FILE *f)
settings->dmesg_warn_level = -1;
- while (fscanf(f, "%ms : %ms", &name, &val) == 2) {
+ while (fscanf(f, "%ms : %m[^\n]", &name, &val) == 2) {
int numval = atoi(val);
PARSE_LINE(settings, name, val, abort_mask, numval);
PARSE_LINE(settings, name, val, test_list, val ? strdup(val) : NULL);