mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 03:21:19 +00:00
util: virNetDevBandwidthClear: use g_auto
Separate the two uses of 'cmd' to avoid mixing manual and automatic cleanup. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
e1470a2295
commit
470987a53f
@ -416,27 +416,24 @@ virNetDevBandwidthClear(const char *ifname)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int dummy; /* for ignoring the exit status */
|
int dummy; /* for ignoring the exit status */
|
||||||
virCommand *cmd = NULL;
|
g_autoptr(virCommand) rootcmd = NULL;
|
||||||
|
g_autoptr(virCommand) ingresscmd = NULL;
|
||||||
|
|
||||||
if (!ifname)
|
if (!ifname)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cmd = virCommandNew(TC);
|
rootcmd = virCommandNew(TC);
|
||||||
virCommandAddArgList(cmd, "qdisc", "del", "dev", ifname, "root", NULL);
|
virCommandAddArgList(rootcmd, "qdisc", "del", "dev", ifname, "root", NULL);
|
||||||
|
|
||||||
if (virCommandRun(cmd, &dummy) < 0)
|
if (virCommandRun(rootcmd, &dummy) < 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
virCommandFree(cmd);
|
ingresscmd = virCommandNew(TC);
|
||||||
|
virCommandAddArgList(ingresscmd, "qdisc", "del", "dev", ifname, "ingress", NULL);
|
||||||
|
|
||||||
cmd = virCommandNew(TC);
|
if (virCommandRun(ingresscmd, &dummy) < 0)
|
||||||
virCommandAddArgList(cmd, "qdisc", "del", "dev", ifname, "ingress", NULL);
|
|
||||||
|
|
||||||
if (virCommandRun(cmd, &dummy) < 0)
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
virCommandFree(cmd);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user