[stgt] [PATCH] iscsi: add getsockname and getnameinfo error warnings

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Fri Sep 18 17:23:42 CEST 2009


Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
 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 at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list