From d7e74ba9cb5048f70efae1bf37317d070b56cf54 Mon Sep 17 00:00:00 2001 From: Tianren Zhang Date: Wed, 27 Nov 2024 03:17:05 +0000 Subject: [PATCH] lib: finish event_loop on invalid fd When iscsi->fd gets invalid, there is not point to keep stuck in the event loop, instead could give an accurate error about the invalid fd. Change-Id: Ibad0353dcf50fc7d65332052254d69953595415e --- lib/sync.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/sync.c b/lib/sync.c index abbae9eb..458edd02 100644 --- a/lib/sync.c +++ b/lib/sync.c @@ -91,6 +91,12 @@ event_loop(struct iscsi_context *iscsi, struct iscsi_sync_state *state) state->status = -1; return; } + + if (iscsi->fd < 0) { + iscsi_set_error(iscsi, "Invalid fd %d", iscsi->fd); + state->status = -1; + return; + } } }