From d91000561f82b5fd73fa22d23232ed99d647b962 Mon Sep 17 00:00:00 2001
From: Wanlong Gao <gaowanlong@huawei.com>
Date: Thu, 22 Mar 2018 13:16:47 +0000
Subject: [PATCH] iscsiadm: fix infinite loop while recv() returns 0

[Changelog]: fix infinite loop while recv() returns 0
[Author]: Jiao Jianbing

Signed-off-by: Jiao Jianbing <jiaojianbing@huawei.com>
Signed-off-by: Wanlong Gao <gaowanlong@huawei.com>
---
 usr/iscsid_req.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c
index f0b474f..808d5fe 100644
--- a/usr/iscsid_req.c
+++ b/usr/iscsid_req.c
@@ -173,7 +173,7 @@ int iscsid_response(int fd, iscsiadm_cmd_e cmd, iscsiadm_rsp_t *rsp,
 			return ISCSI_ERR_ISCSID_COMM_ERR;
 		} else if (pfd.revents & POLLIN) {
 			err = recv(fd, rsp, sizeof(*rsp), MSG_WAITALL);
-			if (err < 0) {
+			if (err <= 0) {
 				log_error("read error (%d/%d), daemon died?",
 					  err, errno);
 				break;
-- 
1.8.3.1

