Skip to contentSkip to conversation

net: Do not include a newline in the id of -nic devices

PATCH Applied Thomas Huth 3 participants 4 messages May 18, 2020 – Jun 9, 2020 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Do not include a newline in the id of -nic devices

The '\n' sneaked in by accident here, an "id" string should really not contain a newline character at the end.

Fixes 78cd6f7bf6b ('net: Add a new convenience option "--nic" ...')
---
 net/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/net.c +1 -1
index 38778e831d..cbeeeadff8 100644
@@ -1506,7 +1506,7 @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp)
     /* Create an ID if the user did not specify one */
     nd_id = g_strdup(qemu_opts_id(opts));
     if (!nd_id) {
-        nd_id = g_strdup_printf("__org.qemu.nic%i\n", idx);
+        nd_id = g_strdup_printf("__org.qemu.nic%i", idx);
         qemu_opts_set_id(opts, nd_id);
     }
 
Signature · 1 line
2.18.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Thomas Huth

The '\n' sneaked in by accident here, an "id" string should really not contain a newline character at the end.

Fixes 78cd6f7bf6b ('net: Add a new convenience option "--nic" ...')
---
  net/net.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
net/net.c +0 -0
index 38778e831d..cbeeeadff8 100644

net/net.c static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp) · line 1512

Quoted 8 lines
net/net.c +1 -1
@@ -1506,7 +1506,7 @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp)
      /* Create an ID if the user did not specify one */
      nd_id = g_strdup(qemu_opts_id(opts));
      if (!nd_id) {
-        nd_id = g_strdup_printf("__org.qemu.nic%i\n", idx);
+        nd_id = g_strdup_printf("__org.qemu.nic%i", idx);
          qemu_opts_set_id(opts, nd_id);
      }
 
#2 lore raw
In reply to Thomas Huth
Quoted 15 lines · Thomas Huth

The '\n' sneaked in by accident here, an "id" string should really not contain a newline character at the end.

Fixes 78cd6f7bf6b ('net: Add a new convenience option "--nic" ...')
---
 net/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/net.c +0 -0
index 38778e831d..cbeeeadff8 100644

net/net.c static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp) · line 1512

Quoted 8 lines
net/net.c +1 -1
@@ -1506,7 +1506,7 @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp)
     /* Create an ID if the user did not specify one */
     nd_id = g_strdup(qemu_opts_id(opts));
     if (!nd_id) {
-        nd_id = g_strdup_printf("__org.qemu.nic%i\n", idx);
+        nd_id = g_strdup_printf("__org.qemu.nic%i", idx);
         qemu_opts_set_id(opts, nd_id);
     }
 

ping?

#3 lore raw
In reply to Thomas Huth

Le 18/05/2020 à 09:43, Thomas Huth a écrit :

Quoted 15 lines

The '\n' sneaked in by accident here, an "id" string should really not contain a newline character at the end.

Fixes 78cd6f7bf6b ('net: Add a new convenience option "--nic" ...')
---
 net/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/net.c +0 -0
index 38778e831d..cbeeeadff8 100644

net/net.c static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp) · line 1512

Quoted 8 lines
net/net.c +1 -1
@@ -1506,7 +1506,7 @@ static int net_param_nic(void *dummy, QemuOpts *opts, Error **errp)
     /* Create an ID if the user did not specify one */
     nd_id = g_strdup(qemu_opts_id(opts));
     if (!nd_id) {
-        nd_id = g_strdup_printf("__org.qemu.nic%i\n", idx);
+        nd_id = g_strdup_printf("__org.qemu.nic%i", idx);
         qemu_opts_set_id(opts, nd_id);
     }
 

Applied to my trivial-patches branch.

Thanks,
Laurent