提交 e9d4912c 编写于 作者: S Syed Humaid 提交者: Michal Privoznik

network: Convert to virErrorRestore/virErrorPreserveLast

Replaced usage of virSaveLastError and virSetError/virFreeError with
virErrorPreserveLast and virErrorRestore respectively.
Signed-off-by: NSyed Humaid <syedhumaidbinharoon@gmail.com>
上级 528e26e7
...@@ -2498,7 +2498,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver, ...@@ -2498,7 +2498,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
err4: err4:
if (!save_err) if (!save_err)
save_err = virSaveLastError(); virErrorPreserveLast(&save_err);
dnsmasqPid = virNetworkObjGetDnsmasqPid(obj); dnsmasqPid = virNetworkObjGetDnsmasqPid(obj);
if (dnsmasqPid > 0) { if (dnsmasqPid > 0) {
...@@ -2508,18 +2508,18 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver, ...@@ -2508,18 +2508,18 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
err3: err3:
if (!save_err) if (!save_err)
save_err = virSaveLastError(); virErrorPreserveLast(&save_err);
ignore_value(virNetDevSetOnline(def->bridge, 0)); ignore_value(virNetDevSetOnline(def->bridge, 0));
err2: err2:
if (!save_err) if (!save_err)
save_err = virSaveLastError(); virErrorPreserveLast(&save_err);
if (def->forward.type != VIR_NETWORK_FORWARD_OPEN) if (def->forward.type != VIR_NETWORK_FORWARD_OPEN)
networkRemoveFirewallRules(def); networkRemoveFirewallRules(def);
err1: err1:
if (!save_err) if (!save_err)
save_err = virSaveLastError(); virErrorPreserveLast(&save_err);
if (macTapIfName) { if (macTapIfName) {
VIR_FORCE_CLOSE(tapfd); VIR_FORCE_CLOSE(tapfd);
...@@ -2531,13 +2531,10 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver, ...@@ -2531,13 +2531,10 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
err0: err0:
if (!save_err) if (!save_err)
save_err = virSaveLastError(); virErrorPreserveLast(&save_err);
ignore_value(virNetDevBridgeDelete(def->bridge)); ignore_value(virNetDevBridgeDelete(def->bridge));
if (save_err) { virErrorRestore(&save_err);
virSetError(save_err);
virFreeError(save_err);
}
/* coverity[leaked_handle] - 'tapfd' is not leaked */ /* coverity[leaked_handle] - 'tapfd' is not leaked */
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册