提交 e69a85cc 编写于 作者: J John Ferlan 提交者: Martin Kletzander

tools: Check return status on virBufferTrim()

上级 d514d777
...@@ -536,6 +536,8 @@ vshTreePrintInternal(vshControl *ctl, ...@@ -536,6 +536,8 @@ vshTreePrintInternal(vshControl *ctl,
/* Finally print all children */ /* Finally print all children */
virBufferAddLit(indent, " "); virBufferAddLit(indent, " ");
if (virBufferError(indent))
goto cleanup;
for (i = 0 ; i < num_devices ; i++) { for (i = 0 ; i < num_devices ; i++) {
const char *parent = (lookup)(i, true, opaque); const char *parent = (lookup)(i, true, opaque);
...@@ -545,15 +547,18 @@ vshTreePrintInternal(vshControl *ctl, ...@@ -545,15 +547,18 @@ vshTreePrintInternal(vshControl *ctl,
false, indent) < 0) false, indent) < 0)
goto cleanup; goto cleanup;
} }
virBufferTrim(indent, " ", -1); if (virBufferTrim(indent, " ", -1) < 0)
goto cleanup;
/* If there was no child device, and we're the last in /* If there was no child device, and we're the last in
* a list of devices, then print another blank line */ * a list of devices, then print another blank line */
if (nextlastdev == -1 && devid == lastdev) if (nextlastdev == -1 && devid == lastdev)
vshPrint(ctl, "%s\n", virBufferCurrentContent(indent)); vshPrint(ctl, "%s\n", virBufferCurrentContent(indent));
if (!root) if (!root) {
virBufferTrim(indent, NULL, 2); if (virBufferTrim(indent, NULL, 2) < 0)
goto cleanup;
}
ret = 0; ret = 0;
cleanup: cleanup:
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册