On 01/25/2018 11:14 AM, Daniel P. Berrangé wrote: > From: "Daniel P. Berrange" <berra...@redhat.com> > > The inet_parse() function looks for 'ipv4' and 'ipv6' flags, but only > treats them as bare bool flags. The normal QemuOpts parsing would allow > on/off values to be set too. > > This updates inet_parse() so that its handling of the 'ipv4' and 'ipv6' > flags matches that done by QemuOpts. > > This impacts the NBD block driver parsing the legacy filename syntax and > the migration code parsing the socket scheme. > > Signed-off-by: Daniel P. Berrange <berra...@redhat.com> > --- > util/qemu-sockets.c | 44 ++++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 40 insertions(+), 4 deletions(-) >
> + if (len == 0 || (len == 3 && strncmp(optstr, "=on", len) == 0)) { Good: no parens around 'len == 3' > + *val = true; > + } else if ((len == 4) && strncmp(optstr, "=off", len) == 0) { Not so good: redundant parens around 'len == 4' Bad: Inconsistency between the two forms. With those made consistent, this matches the logic in the static util/qemu-option.c:parse_option_bool(), so it makes sense. Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature