Skip to content

Commit

Permalink
[build] fix clang errors
Browse files Browse the repository at this point in the history
this should fix #32

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Mar 1, 2017
1 parent 0cc85dd commit 630e331
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libknet/handle.c
Expand Up @@ -1081,7 +1081,7 @@ int knet_handle_setfwd(knet_handle_t knet_h, unsigned int enabled)
return -1;
}

if ((enabled < 0) || (enabled > 1)) {
if (enabled > 1) {
errno = EINVAL;
return -1;
}
Expand Down
6 changes: 5 additions & 1 deletion libknet/tests/knet_bench.c
Expand Up @@ -240,7 +240,11 @@ static void setup_knet(int argc, char *argv[])
policy = KNET_LINK_POLICY_ACTIVE;
policyfound = 1;
}
if (!strcmp(policystr, "rr")) {
/*
* we can't use rr because clangs can't compile
* an array of 3 strings, one of which is 2 bytes long
*/
if (!strcmp(policystr, "round-robin")) {
policy = KNET_LINK_POLICY_RR;
policyfound = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions libknet/transport_udp.c
Expand Up @@ -310,7 +310,7 @@ static int read_errs_from_sock(knet_handle_t knet_h, int sockfd)
for (cmsg = CMSG_FIRSTHDR(&msg);cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
if (((cmsg->cmsg_level == SOL_IP) && (cmsg->cmsg_type == IP_RECVERR)) ||
((cmsg->cmsg_level == SOL_IPV6 && (cmsg->cmsg_type == IPV6_RECVERR)))) {
sock_err = (struct sock_extended_err*)CMSG_DATA(cmsg);
sock_err = (struct sock_extended_err*)(void *)CMSG_DATA(cmsg);
if (sock_err) {
switch (sock_err->ee_origin) {
case 0: /* no origin */
Expand All @@ -321,7 +321,7 @@ static int read_errs_from_sock(knet_handle_t knet_h, int sockfd)
break;
case 2: /* ICMP */
case 3: /* ICMP6 */
origin = (struct sockaddr_storage *)SO_EE_OFFENDER(sock_err);
origin = (struct sockaddr_storage *)(void *)SO_EE_OFFENDER(sock_err);
if (knet_addrtostr(origin, sizeof(origin),
addr_str, KNET_MAX_HOST_LEN,
port_str, KNET_MAX_PORT_LEN) < 0) {
Expand Down

0 comments on commit 630e331

Please sign in to comment.