aboutsummaryrefslogtreecommitdiff
path: root/qapi
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-03-20 17:13:43 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-03-21 10:43:01 +0100
commitd2788227c6185c72d88ef3127e9fed41686f8e39 (patch)
tree35e49cc56a1dffceeb9c341a9852df2b2fbe0c53 /qapi
parentc32617a1941aadfe580af6c4418ef02c9644cd44 (diff)
downloadqemu-d2788227c6185c72d88ef3127e9fed41686f8e39.zip
qemu-d2788227c6185c72d88ef3127e9fed41686f8e39.tar.gz
qemu-d2788227c6185c72d88ef3127e9fed41686f8e39.tar.bz2
qapi: Fix string input visitor regression for empty lists
Visiting a list when input is the empty string should result in an empty list, not an error. Noticed when commit 3d089ce belatedly added tests, but simply accepted as weird then. It's actually a regression: broken in commit 74f24cb, v2.7.0. Fix it, and throw in another test case for empty string. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1490026424-11330-2-git-send-email-armbru@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'qapi')
-rw-r--r--qapi/string-input-visitor.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c
index 806b01ae..c089491 100644
--- a/qapi/string-input-visitor.c
+++ b/qapi/string-input-visitor.c
@@ -54,6 +54,10 @@ static int parse_str(StringInputVisitor *siv, const char *name, Error **errp)
return 0;
}
+ if (!*str) {
+ return 0;
+ }
+
do {
errno = 0;
start = strtoll(str, &endptr, 0);