提交 532e9a34 编写于 作者: J John Ferlan

src: Use consistent error preservation and restoration calls

Provide some consistency over error message variable name and usage
when saving error messages across possible other errors or possibility
of resetting of the last error.

Instead of virSaveLastError paired up with virSetError and virFreeError,
we should use the newer virErrorPreserveLast and virRestoreError.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 4e7b3b1e
......@@ -622,12 +622,11 @@ virStreamSendAll(virStreamPtr stream,
VIR_FREE(bytes);
if (ret != 0) {
virErrorPtr orig_err = virSaveLastError();
virErrorPtr orig_err;
virErrorPreserveLast(&orig_err);
virStreamAbort(stream);
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
virErrorRestore(&orig_err);
virDispatchError(stream->conn);
}
......@@ -794,12 +793,11 @@ int virStreamSparseSendAll(virStreamPtr stream,
VIR_FREE(bytes);
if (ret != 0) {
virErrorPtr orig_err = virSaveLastError();
virErrorPtr orig_err;
virErrorPreserveLast(&orig_err);
virStreamAbort(stream);
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
virErrorRestore(&orig_err);
virDispatchError(stream->conn);
}
......@@ -900,12 +898,11 @@ virStreamRecvAll(virStreamPtr stream,
VIR_FREE(bytes);
if (ret != 0) {
virErrorPtr orig_err = virSaveLastError();
virErrorPtr orig_err;
virErrorPreserveLast(&orig_err);
virStreamAbort(stream);
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
virErrorRestore(&orig_err);
virDispatchError(stream->conn);
}
......@@ -1034,12 +1031,11 @@ virStreamSparseRecvAll(virStreamPtr stream,
VIR_FREE(bytes);
if (ret != 0) {
virErrorPtr orig_err = virSaveLastError();
virErrorPtr orig_err;
virErrorPreserveLast(&orig_err);
virStreamAbort(stream);
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
virErrorRestore(&orig_err);
virDispatchError(stream->conn);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册