From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Andreas Färber" <afaerber@suse.de>,
"Richard Henderson" <rth@twiddle.net>
Subject: [Qemu-devel] [PULL 3/6] qemu-config: Accept empty option values
Date: Mon, 27 Apr 2015 14:58:26 -0300 [thread overview]
Message-ID: <1430157509-9486-4-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1430157509-9486-1-git-send-email-ehabkost@redhat.com>
Currently it is impossible to set an option in a config file to an empty
string, because the parser matches only lines containing non-empty
strings between double-quotes.
As sscanf() "[" conversion specifier only matches non-empty strings, add
a special case for empty strings.
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
util/qemu-config.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/util/qemu-config.c b/util/qemu-config.c
index 2d32ce7..a393a3d 100644
--- a/util/qemu-config.c
+++ b/util/qemu-config.c
@@ -413,7 +413,9 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname)
opts = qemu_opts_create(list, NULL, 0, &error_abort);
continue;
}
- if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2) {
+ value[0] = '\0';
+ if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2 ||
+ sscanf(line, " %63s = \"\"", arg) == 1) {
/* arg = value */
if (opts == NULL) {
error_report("no group defined");
--
2.1.0
next prev parent reply other threads:[~2015-04-27 17:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-27 17:58 [Qemu-devel] [PULL 0/6] X86 patches Eduardo Habkost
2015-04-27 17:58 ` [Qemu-devel] [PULL 1/6] MAINTAINERS: Add myself to X86 Eduardo Habkost
2015-04-27 17:58 ` [Qemu-devel] [PULL 2/6] MAINTAINERS: Change status of X86 to Maintained Eduardo Habkost
2015-04-27 17:58 ` Eduardo Habkost [this message]
2015-04-27 17:58 ` [Qemu-devel] [PULL 4/6] target-i386: Make "level" and "xlevel" properties static Eduardo Habkost
2015-04-27 18:23 ` Andreas Färber
2015-04-27 18:27 ` Eduardo Habkost
2015-04-27 17:58 ` [Qemu-devel] [PULL 5/6] target-i386: X86CPU::xlevel2 QOM property Eduardo Habkost
2015-04-27 17:58 ` [Qemu-devel] [PULL 6/6] target-i386: Remove AMD feature flag aliases from CPU model table Eduardo Habkost
2015-04-27 18:17 ` [Qemu-devel] [PULL 0/6] X86 patches Andreas Färber
2015-04-27 18:25 ` Andreas Färber
2015-04-27 18:37 ` Eduardo Habkost
2015-04-27 18:54 ` Michael S. Tsirkin
2015-04-27 19:00 ` Eduardo Habkost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430157509-9486-4-git-send-email-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=afaerber@suse.de \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.