nbdkit/0005-data-Permit-whitespace-at-the-end-of-the-data-string.patch

30 lines
853 B
Diff
Raw Normal View History

2018-08-27 18:41:52 +00:00
From f6d1419f36905965ec5ccb43236617639ea21c7f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 27 Aug 2018 18:52:51 +0100
Subject: [PATCH 5/6] data: Permit whitespace at the end of the data string.
---
plugins/data/data.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/plugins/data/data.c b/plugins/data/data.c
index 3d27227..0925233 100644
--- a/plugins/data/data.c
+++ b/plugins/data/data.c
@@ -141,6 +141,12 @@ read_data (const char *value)
return -1;
offset++;
}
+ /* We have to have a rule to skip just whitespace so that
+ * whitespace is permitted at the end of the string.
+ */
+ else if (sscanf (&value[i], " %n", &n) == 0) {
+ i += n;
+ }
else {
nbdkit_error ("data parameter: parsing error at offset %zu", i);
return -1;
--
2.18.0