transport: pldm_transport_poll(): Handle errors from ->init_pollfd()
A failure of the callback may cause a subsequent failure of poll() and
we spin in a tight loop.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I4560db91ecb26a7f4618a209e14a33de2dee9976
diff --git a/src/transport/transport.c b/src/transport/transport.c
index 21fb878..dd9a4bd 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -42,7 +42,11 @@
return PLDM_REQUESTER_SUCCESS;
}
- transport->init_pollfd(transport, &pollfd);
+ rc = transport->init_pollfd(transport, &pollfd);
+ if (rc < 0) {
+ return PLDM_REQUESTER_POLL_FAIL;
+ }
+
rc = poll(&pollfd, 1, timeout);
if (rc < 0) {
return PLDM_REQUESTER_POLL_FAIL;