mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
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: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
6f8aa8e8da
commit
5b62dacb70
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user