diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2016-03-07 20:36:03 +0000 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2016-03-10 17:19:34 +0000 |
commit | b16a44e13e89ee397a3d9a9e3cfa1605c3c1dc68 (patch) | |
tree | 894551b8e7841e2fddfd790c204b7ef453d6f2eb /migration/qemu-file-unix.c | |
parent | a2d96af4bb267bd1844f71f593d07273c7fc134c (diff) |
osdep: remove use of socket_error() from all code
Now that QEMU wraps the Win32 sockets methods to automatically
set errno upon failure, there is no reason for callers to use
the socket_error() method. They can rely on accessing errno
even on Win32. Remove all use of socket_error() from general
code, leaving it as a static method in oslib-win32.c only.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'migration/qemu-file-unix.c')
-rw-r--r-- | migration/qemu-file-unix.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/migration/qemu-file-unix.c b/migration/qemu-file-unix.c index 61b059b25b..4474e18ff8 100644 --- a/migration/qemu-file-unix.c +++ b/migration/qemu-file-unix.c @@ -53,18 +53,16 @@ static ssize_t socket_writev_buffer(void *opaque, struct iovec *iov, int iovcnt, } if (size > 0) { - err = socket_error(); - - if (err != EAGAIN && err != EWOULDBLOCK) { + if (errno != EAGAIN && errno != EWOULDBLOCK) { error_report("socket_writev_buffer: Got err=%d for (%zu/%zu)", - err, (size_t)size, (size_t)len); + errno, (size_t)size, (size_t)len); /* * If I've already sent some but only just got the error, I * could return the amount validly sent so far and wait for the * next call to report the error, but I'd rather flag the error * immediately. */ - return -err; + return -errno; } /* Emulate blocking */ @@ -99,15 +97,15 @@ static ssize_t socket_get_buffer(void *opaque, uint8_t *buf, int64_t pos, if (len != -1) { break; } - if (socket_error() == EAGAIN) { + if (errno == EAGAIN) { yield_until_fd_readable(s->fd); - } else if (socket_error() != EINTR) { + } else if (errno != EINTR) { break; } } if (len == -1) { - len = -socket_error(); + len = -errno; } return len; } |