diff options
author | 2012-06-13 10:54:02 +0100 | |
---|---|---|
committer | 2012-06-13 16:01:27 +0200 | |
commit | 5d490603a6d60298162cbd32ec45f736b58929fb (patch) | |
tree | 66c3a7f147289ef3689ec8d10a67cb40e24b85c7 /src/rpc/virnetclient.c | |
parent | client rpc: Send keepalive requests from IO event loop (diff) | |
download | libvirt-5d490603a6d60298162cbd32ec45f736b58929fb.tar.gz libvirt-5d490603a6d60298162cbd32ec45f736b58929fb.tar.bz2 libvirt-5d490603a6d60298162cbd32ec45f736b58929fb.zip |
client rpc: Fix error checking after poll()
First 'poll' can't return EWOULDBLOCK, and second, we're checking errno
so far away from the poll() call that we've probably already trashed the
original errno value.
Diffstat (limited to 'src/rpc/virnetclient.c')
-rw-r--r-- | src/rpc/virnetclient.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 033fda6e1..49d238e27 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -1347,6 +1347,12 @@ static int virNetClientIOEventLoop(virNetClientPtr client, virNetClientLock(client); + if (ret < 0) { + virReportSystemError(errno, + "%s", _("poll on socket failed")); + goto error; + } + if (virKeepAliveTrigger(client->keepalive, &msg)) { client->wantClose = true; } else if (msg && virNetClientQueueNonBlocking(client, msg) < 0) { @@ -1375,15 +1381,6 @@ static int virNetClientIOEventLoop(virNetClientPtr client, } } - if (ret < 0) { - /* XXX what's this dubious errno check doing ? */ - if (errno == EWOULDBLOCK) - continue; - virReportSystemError(errno, - "%s", _("poll on socket failed")); - goto error; - } - if (fds[0].revents & POLLOUT) { if (virNetClientIOHandleOutput(client) < 0) goto error; |