提交 5b62dacb 编写于 作者: M Michal Privoznik

virStream*All: Preserve reported error

If one these four functions fail (virStreamRecvAll,
virStreamSendAll, virStreamSparseRecvAll, virStreamSparseSendAll)
the stream is aborted by calling virStreamAbort(). This is  a
public API; therefore, the first thing it does is error reset. At
that point any error that caused us to abort stream in the first
place is gone.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 6f8aa8e8
......@@ -616,7 +616,12 @@ virStreamSendAll(virStreamPtr stream,
VIR_FREE(bytes);
if (ret != 0) {
virErrorPtr orig_err = virSaveLastError();
virStreamAbort(stream);
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
virDispatchError(stream->conn);
}
......@@ -771,7 +776,12 @@ int virStreamSparseSendAll(virStreamPtr stream,
VIR_FREE(bytes);
if (ret != 0) {
virErrorPtr orig_err = virSaveLastError();
virStreamAbort(stream);
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
virDispatchError(stream->conn);
}
......@@ -865,7 +875,12 @@ virStreamRecvAll(virStreamPtr stream,
VIR_FREE(bytes);
if (ret != 0) {
virErrorPtr orig_err = virSaveLastError();
virStreamAbort(stream);
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
virDispatchError(stream->conn);
}
......@@ -985,7 +1000,12 @@ virStreamSparseRecvAll(virStreamPtr stream,
VIR_FREE(bytes);
if (ret != 0) {
virErrorPtr orig_err = virSaveLastError();
virStreamAbort(stream);
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
virDispatchError(stream->conn);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册