Fix false positive on failure

When running mckey, errors may happen in the init/connect stage.
When leaving multicast groups, we override this value.

Fix that by saving the return value from rdma_leave_multicast to different
parameter, and only in case of failure in rdma_leave_multicast override it.

MFC after:      1 week
Approved by:    hselasky (mentor), kib (mentor)
Sponsored by:   Mellanox Technologies
This commit is contained in:
Slava Shwartsman 2018-06-17 07:08:47 +00:00
parent 5164504a9e
commit cd9cc48b9a

View File

@ -475,7 +475,7 @@ static int get_dst_addr(char *dst, struct sockaddr *addr)
static int run(void)
{
int i, ret;
int i, ret, err;
printf("mckey: starting %s\n", is_sender ? "client" : "server");
if (src_addr) {
@ -543,10 +543,12 @@ static int run(void)
}
out:
for (i = 0; i < connections; i++) {
ret = rdma_leave_multicast(test.nodes[i].cma_id,
err = rdma_leave_multicast(test.nodes[i].cma_id,
test.dst_addr);
if (ret)
if (err) {
perror("mckey: failure leaving");
ret = err;
}
}
return ret;
}