From: Yalei Li <274268859@qq.com> Date: Fri, 5 Feb 2021 03:10:51 +0000 (+0800) Subject: util: Remove '\n' from vhostuser ifname X-Git-Tag: v7.1.0-rc1~238 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b29c86ae1042fc44e7c86f3519f048a696e68afe;p=thirdparty%2Flibvirt.git util: Remove '\n' from vhostuser ifname When deleting the vhostuserclient interface, OVS prompts that the interface does not exist, Through the XML file, I found that the "target dev" has a '\n', results in an XML parsing error. XML file: That is because 'ovs-vsctl' returns a newline result, always come with a '\n', and the vircommandrun function puts it in ifname. So virNetDevOpenvswitchGetVhostuserIfname should remove '\n' from ifname. Signed-off-by: Yalei Li Reviewed-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- 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;