|
|
dc245c |
handle bad iscsi->fd in iscsi_service
|
|
|
dc245c |
|
|
|
dc245c |
Message-id: <1383729402-27559-10-git-send-email-pbonzini@redhat.com>
|
|
|
dc245c |
Patchwork-id: 55504
|
|
|
dc245c |
O-Subject: [PATCH 09/11] handle bad iscsi->fd in iscsi_service
|
|
|
dc245c |
Bugzilla: 1026820
|
|
|
dc245c |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
dc245c |
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
dc245c |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
dc245c |
|
|
|
dc245c |
Just do nothing if the file descriptor is invalid.
|
|
|
dc245c |
|
|
|
dc245c |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
dc245c |
(cherry picked from commit bb0e59055aeb69b0b035e2c2f848d8e82c96eade)
|
|
|
dc245c |
---
|
|
|
dc245c |
lib/socket.c | 5 ++++-
|
|
|
dc245c |
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
dc245c |
diff --git a/lib/socket.c b/lib/socket.c
|
|
|
dc245c |
index 8f7ebb2..78dfbfe 100644
|
|
|
dc245c |
--- a/lib/socket.c
|
|
|
dc245c |
+++ b/lib/socket.c
|
|
|
dc245c |
@@ -691,6 +691,9 @@ iscsi_service_reconnect_if_loggedin(struct iscsi_context *iscsi)
|
|
|
dc245c |
int
|
|
|
dc245c |
iscsi_service(struct iscsi_context *iscsi, int revents)
|
|
|
dc245c |
{
|
|
|
dc245c |
+ if (iscsi->fd < 0)
|
|
|
dc245c |
+ return 0;
|
|
|
dc245c |
+
|
|
|
dc245c |
if (revents & POLLERR) {
|
|
|
dc245c |
int err = 0;
|
|
|
dc245c |
socklen_t err_size = sizeof(err);
|
|
|
dc245c |
@@ -725,7 +728,7 @@ iscsi_service(struct iscsi_context *iscsi, int revents)
|
|
|
dc245c |
return iscsi_service_reconnect_if_loggedin(iscsi);
|
|
|
dc245c |
}
|
|
|
dc245c |
|
|
|
dc245c |
- if (iscsi->is_connected == 0 && iscsi->fd != -1 && revents&POLLOUT) {
|
|
|
dc245c |
+ if (iscsi->is_connected == 0 && revents&POLLOUT) {
|
|
|
dc245c |
int err = 0;
|
|
|
dc245c |
socklen_t err_size = sizeof(err);
|
|
|
dc245c |
if (getsockopt(iscsi->fd, SOL_SOCKET, SO_ERROR,
|