[PATCH] virNetDevOpenvswitchGetVhostuserIfname: Remove a single '\n' from ifname

Yalei Li posted 1 patch 3 years, 3 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/tencent_B6E765E2DF3596F64255F8AC2ADC52A0F506@qq.com
src/util/virnetdevopenvswitch.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] virNetDevOpenvswitchGetVhostuserIfname: Remove a single '\n' from ifname
Posted by Yalei Li 3 years, 3 months ago
Ovs-vsctl returns a newline result.
Signed-off-by: Yalei Li <liyl43@chinatelecom.cn>
---
 src/util/virnetdevopenvswitch.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index f9b3369b2a..bd840bd3b7 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -575,6 +575,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path,
         return 0;
     }
 
+    virStringTrimOptionalNewline(*ifname);
     if (virNetDevOpenvswitchMaybeUnescapeReply(*ifname) < 0) {
         VIR_FREE(*ifname);
         return -1;
-- 
2.27.0

Re: [PATCH] virNetDevOpenvswitchGetVhostuserIfname: Remove a single '\n' from ifname
Posted by Daniel Henrique Barboza 3 years, 3 months ago

On 1/22/21 7:26 AM, Yalei Li wrote:
> Ovs-vsctl returns a newline result.
> Signed-off-by: Yalei Li <liyl43@chinatelecom.cn>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

>   src/util/virnetdevopenvswitch.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
> index f9b3369b2a..bd840bd3b7 100644
> --- a/src/util/virnetdevopenvswitch.c
> +++ b/src/util/virnetdevopenvswitch.c
> @@ -575,6 +575,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path,
>           return 0;
>       }
>   
> +    virStringTrimOptionalNewline(*ifname);
>       if (virNetDevOpenvswitchMaybeUnescapeReply(*ifname) < 0) {
>           VIR_FREE(*ifname);
>           return -1;
>