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.
(cherry picked from commit 5d490603a6)
This commit is contained in:
Daniel P. Berrange 2012-06-13 10:54:02 +01:00 committed by Cole Robinson
parent e9c00cbc63
commit 086c3fbab1

View File

@ -1335,6 +1335,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) {
@ -1363,15 +1369,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;