[PATCH] iscsi: add getsockname and getnameinfo error warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>
---
 usr/iscsi/iscsid.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 047b38e..e7d4c11 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -773,6 +773,7 @@ static void text_scan_text(struct iscsi_connection *conn)
 			struct sockaddr_storage ss;
 			socklen_t slen, blen;
 			char *p, buf[NI_MAXHOST + 128];
+			int ret;
 
 			if (value[0] == 0)
 				continue;
@@ -781,15 +782,25 @@ static void text_scan_text(struct iscsi_connection *conn)
 			blen = sizeof(buf);
 
 			slen = sizeof(ss);
-			conn->tp->ep_getsockname(conn, (struct sockaddr *) &ss,
-						 &slen);
+			ret = conn->tp->ep_getsockname(conn,
+						       (struct sockaddr *)&ss,
+						       &slen);
+			if (ret) {
+				eprintf("getsockname failed\n");
+				continue;
+			}
+
 			if (ss.ss_family == AF_INET6) {
 				*p++ = '[';
 				blen--;
 			}
 
-			getnameinfo((struct sockaddr *) &ss, slen, p, blen,
-				    NULL, 0, NI_NUMERICHOST);
+			ret = getnameinfo((struct sockaddr *)&ss, slen, p, blen,
+					  NULL, 0, NI_NUMERICHOST);
+			if (ret) {
+				eprintf("getnameinfo failed, %m\n");
+				continue;
+			}
 
 			p = buf + strlen(buf);
 
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux