io: error_prepend() in qio_channel_readv_full_all() causes segfault
Using error_prepend() in qio_channel_readv_full_all() causes a segfault as errp is not set when ret is 0. This results in the failure of iotest 83. Replacing with error_setg() fixes the problem. Additionally, removes a full stop at the end of error message Reported-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com> Fixes: bebab91ebdfc591f8793a9a17370df1bfbe8b2ca (io: add qio_channel_readv_full_all_eof & qio_channel_readv_full_all helpers) Message-Id: <be476bcdb99e820fec0fa09fe8f04c9dd3e62473.1613128220.git.jag.raman@oracle.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
e055a5c8dc
commit
c90e3512a4
@ -202,8 +202,7 @@ int qio_channel_readv_full_all(QIOChannel *ioc,
|
|||||||
int ret = qio_channel_readv_full_all_eof(ioc, iov, niov, fds, nfds, errp);
|
int ret = qio_channel_readv_full_all_eof(ioc, iov, niov, fds, nfds, errp);
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
error_prepend(errp,
|
error_setg(errp, "Unexpected end-of-file before all data were read");
|
||||||
"Unexpected end-of-file before all data were read.");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user