diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2015-07-08 14:37:48 +0100 |
---|---|---|
committer | Jeff Cody <jcody@redhat.com> | 2015-07-14 21:50:13 -0400 |
commit | 796a060bc0fab40953997976a2e30d9d6235bc7b (patch) | |
tree | b05323aba0ef9db54d682c2e55a804a4ff80a6c8 /block/dmg.c | |
parent | 48ac0a4df84662f23da25262443e1810b70c2228 (diff) |
block/curl: Don't lose original error when a connection fails.
Currently if qemu is connected to a curl source (eg. web server), and
the web server fails / times out / dies, you always see a bogus EIO
"Input/output error".
For example, choose a large file located on any local webserver which
you control:
$ qemu-img convert -p http://example.com/large.iso /tmp/test
Once it starts copying the file, stop the webserver and you will see
qemu-img fail with:
qemu-img: error while reading sector 61440: Input/output error
This patch does two things: Firstly print the actual error from curl
so it doesn't get lost. Secondly, change EIO to EPROTO. EPROTO is a
POSIX.1 compatible errno which more accurately reflects that there was
a protocol error, rather than some kind of hardware failure.
After this patch is applied, the error changes to:
$ qemu-img convert -p http://example.com/large.iso /tmp/test
qemu-img: curl: transfer closed with 469989 bytes remaining to read
qemu-img: error while reading sector 16384: Protocol error
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Diffstat (limited to 'block/dmg.c')
0 files changed, 0 insertions, 0 deletions