Skip to contentSkip to conversation

ibacm/acme.c: acm/acme.c: Better error handling in resolve_gid

PATCH Applied Hal Rosenstock 2 participants 2 messages Apr 5, 2012 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ibacm/acme.c: acm/acme.c: Better error handling in resolve_gid

A return of 0 is an error for inet_pton but if 0 is returned from resolve_gid, show_path is mistakenly called so if 0 is returned from inet_pton, return -1 instead (which is what is done elsewhere in acme).

---

src/acme.c +8 -2
index 3d7461b..3e5f301 100644
@@ -513,13 +513,19 @@ static int resolve_gid(struct ibv_path_record *path)
 	ret = inet_pton(AF_INET6, src_addr, &path->sgid);
 	if (ret <= 0) {
 		printf("inet_pton error on source address (%s): 0x%x\n", src_addr, ret);
-		return ret;
+		if (ret)
+			return ret;
+		else
+			return -1;
 	}
 
 	ret = inet_pton(AF_INET6, dest_addr, &path->dgid);
 	if (ret <= 0) {
 		printf("inet_pton error on dest address (%s): 0x%x\n", dest_addr, ret);
-		return ret;
+		if (ret)
+			return ret;
+		else
+			return -1;
 	}
 
 	path->reversible_numpath = IBV_PATH_RECORD_REVERSIBLE | 1;

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 4F7E06E1.1040609-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org