summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnthony PERARD <anthony.perard@citrix.com>2012-11-16 04:08:14 +0000
committermalc <av1474@comtv.ru>2012-11-21 12:07:59 +0400
commit1ccbc2851282564308f790753d7158487b6af8e2 (patch)
tree891a2917d6ffff9793b6c2a419b3a155a1f2bf17
parentecf51c9abe63eae282e5f912d9367ce75f36636a (diff)
downloadfocaccia-qemu-1ccbc2851282564308f790753d7158487b6af8e2.tar.gz
focaccia-qemu-1ccbc2851282564308f790753d7158487b6af8e2.zip
qemu-sockets: Fix parsing of the inet option 'to'.
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>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
-rw-r--r--qemu-sockets.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/qemu-sockets.c b/qemu-sockets.c
index cfed9c5a5b..d314cf1d1b 100644
--- a/qemu-sockets.c
+++ b/qemu-sockets.c
@@ -529,8 +529,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 (sscanf(h, "%d%n", &to, &pos) != 1 ||
+            (h[pos] != '\0' && h[pos] != ',')) {
             error_setg(errp, "error parsing to= argument");
             goto fail;
         }