diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2011-11-04 15:51:18 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-11-11 14:02:58 +0100 |
commit | 74624688b3c003d1ed2763953aaf59974965fa22 (patch) | |
tree | 885360bdba04aebef0e70e24f785bafb47627087 /nbd.c | |
parent | 4480de19d9b62c20e8cae0bcb6c2d00a954615a3 (diff) | |
download | qemu-74624688b3c003d1ed2763953aaf59974965fa22.zip qemu-74624688b3c003d1ed2763953aaf59974965fa22.tar.gz qemu-74624688b3c003d1ed2763953aaf59974965fa22.tar.bz2 |
nbd: treat EPIPE from NBD_DO_IT as success
This can be seen with "qemu-nbd -v -c", which returns 1 instead of 0
when you disconnect with "qemu-nbd -d".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'nbd.c')
-rw-r--r-- | nbd.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -425,6 +425,13 @@ int nbd_client(int fd) TRACE("Doing NBD loop"); ret = ioctl(fd, NBD_DO_IT); + if (ret == -1 && errno == EPIPE) { + /* NBD_DO_IT normally returns EPIPE when someone has disconnected + * the socket via NBD_DISCONNECT. We do not want to return 1 in + * that case. + */ + ret = 0; + } serrno = errno; TRACE("NBD loop returned %d: %s", ret, strerror(serrno)); |