Skip to contentSkip to conversation

Fix corner case in chardev udp: parameter

PATCH In review Jan Kiszka 3 participants 7 messages Jan 15, 2010 – Feb 28, 2010

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 Fix corner case in chardev udp: parameter

The missing '@' broke 'udp::<port>@:<port>' parsing.

---

 qemu-char.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
qemu-char.c +1 -1
index b13f8d4..a8a92f5 100644
@@ -2314,7 +2314,7 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
         qemu_opt_set(opts, "backend", "udp");
         if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port, &pos) < 2) {
             host[0] = 0;
-            if (sscanf(p, ":%32[^,]%n", port, &pos) < 1) {
+            if (sscanf(p, ":%32[^@,]%n", port, &pos) < 1) {
                 fprintf(stderr, "udp #1\n");
                 goto fail;
             }
#1 lore raw

Review

Quoted 6 lines · Jan Kiszka

The missing '@' broke 'udp::<port>@:<port>' parsing.

          if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port,&pos)<  2) {
              host[0] = 0;
(quoted diff) +1 -1
-            if (sscanf(p, ":%32[^,]%n", port,&pos)<  1) {
+            if (sscanf(p, ":%32[^@,]%n", port,&pos)<  1) {

Indeed.

Quoted 1 line
                  fprintf(stderr, "udp #1\n");

While you are at it, can you also zap this debug leftover?

thanks,
Gerd

author
#2 lore raw
Quoted 8 lines · Gerd Hoffmann

Review

Quoted 6 lines · Jan Kiszka

The missing '@' broke 'udp::<port>@:<port>' parsing.

          if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port,&pos)<  2) {
              host[0] = 0;
(quoted diff) +1 -1
-            if (sscanf(p, ":%32[^,]%n", port,&pos)<  1) {
+            if (sscanf(p, ":%32[^@,]%n", port,&pos)<  1) {
Quoted 5 lines

Indeed.

Quoted 1 line
                  fprintf(stderr, "udp #1\n");

While you are at it, can you also zap this debug leftover?

Looks like there are three of them in qemu_chr_parse_compat - kill them all?

Jan

#3 lore raw
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · Gerd Hoffmann
Quoted 6 lines · Jan Kiszka

The missing '@' broke 'udp::<port>@:<port>' parsing.

           if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port,&pos)<   2) {
               host[0] = 0;
(quoted diff) +1 -1
-            if (sscanf(p, ":%32[^,]%n", port,&pos)<   1) {
+            if (sscanf(p, ":%32[^@,]%n", port,&pos)<   1) {
Quoted 7 lines
Quoted 5 lines

Indeed.

Quoted 1 line
                   fprintf(stderr, "udp #1\n");

While you are at it, can you also zap this debug leftover?

Looks like there are three of them in qemu_chr_parse_compat - kill them all?

Yes.

thanks,
Gerd

author
#4 lore raw

PATCH 1/1 Drop debug printfs from qemu_chr_parse_compat

Quoted 16 lines · Gerd Hoffmann
Quoted 15 lines · Jan Kiszka
Quoted 13 lines · Gerd Hoffmann

Review

Quoted 6 lines · Jan Kiszka

The missing '@' broke 'udp::<port>@:<port>' parsing.

           if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port,&pos)<   2) {
               host[0] = 0;
(quoted diff) +1 -1
-            if (sscanf(p, ":%32[^,]%n", port,&pos)<   1) {
+            if (sscanf(p, ":%32[^@,]%n", port,&pos)<   1) {

Indeed.

Quoted 1 line
                   fprintf(stderr, "udp #1\n");

While you are at it, can you also zap this debug leftover?

Quoted 8 lines
Quoted 2 lines

Looks like there are three of them in qemu_chr_parse_compat - kill them all?

Yes.

thanks,
Gerd

---

 qemu-char.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
qemu-char.c +0 -3
index a8a92f5..ef7823f 100644
@@ -2315,7 +2315,6 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
         if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port, &pos) < 2) {
             host[0] = 0;
             if (sscanf(p, ":%32[^@,]%n", port, &pos) < 1) {
-                fprintf(stderr, "udp #1\n");
                 goto fail;
             }
         }
@@ -2326,7 +2325,6 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
             if (sscanf(p, "%64[^:]:%32[^,]%n", host, port, &pos) < 2) {
                 host[0] = 0;
                 if (sscanf(p, ":%32[^,]%n", port, &pos) < 1) {
-                    fprintf(stderr, "udp #2\n");
                     goto fail;
                 }
             }
@@ -2354,7 +2352,6 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
     }
 
 fail:
-    fprintf(stderr, "%s: fail on \"%s\"\n", __FUNCTION__, filename);
     qemu_opts_del(opts);
     return NULL;
 }
Acked-by on v1 1/1
#5 lore raw

[Qemu-devel] Re: [PATCH][STABLE] Drop debug printfs from qemu_chr_parse_compat

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

While you are at it, can you also zap this debug leftover?

Looks like there are three of them in qemu_chr_parse_compat - kill them all?

Quoted 7 lines
Quoted 5 lines

Yes.

thanks,
Gerd

Review

Quoted 3 lines
(quoted diff) +0 -3
-                fprintf(stderr, "udp #1\n");
-                    fprintf(stderr, "udp #2\n");
-    fprintf(stderr, "%s: fail on \"%s\"\n", __FUNCTION__, filename);

cheers,
Gerd

#6 lore raw

Re: [Qemu-devel] [PATCH][STABLE] Drop debug printfs from qemu_chr_parse_compat

In reply to Jan Kiszka
Quoted 17 lines · Jan Kiszka
Quoted 16 lines · Gerd Hoffmann
Quoted 15 lines · Jan Kiszka
Quoted 13 lines · Gerd Hoffmann

Review

Quoted 6 lines · Jan Kiszka

The missing '@' broke 'udp::<port>@:<port>' parsing.

           if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port,&pos)<   2) {
               host[0] = 0;
(quoted diff) +1 -1
-            if (sscanf(p, ":%32[^,]%n", port,&pos)<   1) {
+            if (sscanf(p, ":%32[^@,]%n", port,&pos)<   1) {

Indeed.

Quoted 1 line
                   fprintf(stderr, "udp #1\n");

While you are at it, can you also zap this debug leftover?

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

Looks like there are three of them in qemu_chr_parse_compat - kill them all?

Yes.

thanks,
Gerd

Thanks, committed to HEAD and cherry-picked in stable-0.12.

Quoted 35 lines

---

 qemu-char.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
qemu-char.c +0 -3
index a8a92f5..ef7823f 100644
@@ -2315,7 +2315,6 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
         if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port, &pos) < 2) {
             host[0] = 0;
             if (sscanf(p, ":%32[^@,]%n", port, &pos) < 1) {
-                fprintf(stderr, "udp #1\n");
                 goto fail;
             }
         }
@@ -2326,7 +2325,6 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
             if (sscanf(p, "%64[^:]:%32[^,]%n", host, port, &pos) < 2) {
                 host[0] = 0;
                 if (sscanf(p, ":%32[^,]%n", port, &pos) < 1) {
-                    fprintf(stderr, "udp #2\n");
                     goto fail;
                 }
             }
@@ -2354,7 +2352,6 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
     }
 
 fail:
-    fprintf(stderr, "%s: fail on \"%s\"\n", __FUNCTION__, filename);
     qemu_opts_del(opts);
     return NULL;
 }
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net