* [Qemu-devel] [PATCH] qemu-sockets: Fix parsing of the inet option 'to'.
@ 2012-11-08 15:11 Anthony PERARD
2012-11-09 2:54 ` Lei Li
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Anthony PERARD @ 2012-11-08 15:11 UTC (permalink / raw)
To: QEMU-devel; +Cc: Anthony PERARD, Paolo Bonzini, Luiz Capitulino
Having a qemu command line argument like "-vnc 127.0.0.1:0,to=99" is broken.
This have been break with commit 879e45c72da1569e07fbbc6a1aa2a708ea796044.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
qemu-sockets.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/qemu-sockets.c b/qemu-sockets.c
index abcd791..11d3d32 100644
--- a/qemu-sockets.c
+++ b/qemu-sockets.c
@@ -551,8 +551,9 @@ static InetSocketAddress *inet_parse(const char *str, Error **errp)
optstr = str + pos;
h = strstr(optstr, ",to=");
if (h) {
- if (1 != sscanf(str, "%d%n", &to, &pos) ||
- (str[pos] != '\0' && str[pos] != ',')) {
+ h += 4;
+ if (1 != sscanf(h, "%d%n", &to, &pos) ||
+ (h[pos] != '\0' && h[pos] != ',')) {
error_setg(errp, "error parsing to= argument");
goto fail;
}
--
Anthony PERARD
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-sockets: Fix parsing of the inet option 'to'.
2012-11-08 15:11 [Qemu-devel] [PATCH] qemu-sockets: Fix parsing of the inet option 'to' Anthony PERARD
@ 2012-11-09 2:54 ` Lei Li
2012-11-09 8:09 ` Paolo Bonzini
2012-11-09 10:44 ` Markus Armbruster
2 siblings, 0 replies; 5+ messages in thread
From: Lei Li @ 2012-11-09 2:54 UTC (permalink / raw)
To: Anthony PERARD; +Cc: Paolo Bonzini, QEMU-devel, Luiz Capitulino
On 11/08/2012 11:11 PM, Anthony PERARD wrote:
> Having a qemu command line argument like "-vnc 127.0.0.1:0,to=99" is broken.
> This have been break with commit 879e45c72da1569e07fbbc6a1aa2a708ea796044.
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
I have the same problem, and it works on Fedora 16 after this patch.
Tested-by: Lei Li <lilei@linux.vnet.ibm.com>
>
> ---
> qemu-sockets.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/qemu-sockets.c b/qemu-sockets.c
> index abcd791..11d3d32 100644
> --- a/qemu-sockets.c
> +++ b/qemu-sockets.c
> @@ -551,8 +551,9 @@ static InetSocketAddress *inet_parse(const char *str, Error **errp)
> optstr = str + pos;
> h = strstr(optstr, ",to=");
> if (h) {
> - if (1 != sscanf(str, "%d%n", &to, &pos) ||
> - (str[pos] != '\0' && str[pos] != ',')) {
> + h += 4;
> + if (1 != sscanf(h, "%d%n", &to, &pos) ||
> + (h[pos] != '\0' && h[pos] != ',')) {
> error_setg(errp, "error parsing to= argument");
> goto fail;
> }
--
Lei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-sockets: Fix parsing of the inet option 'to'.
2012-11-08 15:11 [Qemu-devel] [PATCH] qemu-sockets: Fix parsing of the inet option 'to' Anthony PERARD
2012-11-09 2:54 ` Lei Li
@ 2012-11-09 8:09 ` Paolo Bonzini
2012-11-09 10:44 ` Markus Armbruster
2 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2012-11-09 8:09 UTC (permalink / raw)
To: Anthony PERARD; +Cc: qemu-trivial, QEMU-devel, Luiz Capitulino
Il 08/11/2012 16:11, Anthony PERARD ha scritto:
> Having a qemu command line argument like "-vnc 127.0.0.1:0,to=99" is broken.
> This have been break with commit 879e45c72da1569e07fbbc6a1aa2a708ea796044.
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
>
> ---
> qemu-sockets.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/qemu-sockets.c b/qemu-sockets.c
> index abcd791..11d3d32 100644
> --- a/qemu-sockets.c
> +++ b/qemu-sockets.c
> @@ -551,8 +551,9 @@ static InetSocketAddress *inet_parse(const char *str, Error **errp)
> optstr = str + pos;
> h = strstr(optstr, ",to=");
> if (h) {
> - if (1 != sscanf(str, "%d%n", &to, &pos) ||
> - (str[pos] != '\0' && str[pos] != ',')) {
> + h += 4;
> + if (1 != sscanf(h, "%d%n", &to, &pos) ||
> + (h[pos] != '\0' && h[pos] != ',')) {
> error_setg(errp, "error parsing to= argument");
> goto fail;
> }
>
I was going to submit this exact same patch. Thanks.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
I added qemu-trivial to the Cc list.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-sockets: Fix parsing of the inet option 'to'.
2012-11-08 15:11 [Qemu-devel] [PATCH] qemu-sockets: Fix parsing of the inet option 'to' Anthony PERARD
2012-11-09 2:54 ` Lei Li
2012-11-09 8:09 ` Paolo Bonzini
@ 2012-11-09 10:44 ` Markus Armbruster
2012-11-09 11:36 ` Anthony PERARD
2 siblings, 1 reply; 5+ messages in thread
From: Markus Armbruster @ 2012-11-09 10:44 UTC (permalink / raw)
To: Anthony PERARD; +Cc: Paolo Bonzini, QEMU-devel, Luiz Capitulino
Anthony PERARD <anthony.perard@citrix.com> writes:
> Having a qemu command line argument like "-vnc 127.0.0.1:0,to=99" is broken.
> This have been break with commit 879e45c72da1569e07fbbc6a1aa2a708ea796044.
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
>
> ---
> qemu-sockets.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/qemu-sockets.c b/qemu-sockets.c
> index abcd791..11d3d32 100644
> --- a/qemu-sockets.c
> +++ b/qemu-sockets.c
> @@ -551,8 +551,9 @@ static InetSocketAddress *inet_parse(const char *str, Error **errp)
> optstr = str + pos;
> h = strstr(optstr, ",to=");
> if (h) {
> - if (1 != sscanf(str, "%d%n", &to, &pos) ||
> - (str[pos] != '\0' && str[pos] != ',')) {
> + h += 4;
> + if (1 != sscanf(h, "%d%n", &to, &pos) ||
> + (h[pos] != '\0' && h[pos] != ',')) {
Since you're touching this line anyway, consider cleaning up the Yoda
comparison to sscanf(...) != 1
> error_setg(errp, "error parsing to= argument");
> goto fail;
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-sockets: Fix parsing of the inet option 'to'.
2012-11-09 10:44 ` Markus Armbruster
@ 2012-11-09 11:36 ` Anthony PERARD
0 siblings, 0 replies; 5+ messages in thread
From: Anthony PERARD @ 2012-11-09 11:36 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Paolo Bonzini, QEMU-devel, Luiz Capitulino
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-11-09 11:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-08 15:11 [Qemu-devel] [PATCH] qemu-sockets: Fix parsing of the inet option 'to' Anthony PERARD
2012-11-09 2:54 ` Lei Li
2012-11-09 8:09 ` Paolo Bonzini
2012-11-09 10:44 ` Markus Armbruster
2012-11-09 11:36 ` Anthony PERARD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).