diff options
author | 2015-08-20 10:00:28 -0400 | |
---|---|---|
committer | 2015-08-20 10:00:28 -0400 | |
commit | 5c0edb3435a07372bf89ef19e9730066aecc6b8c (patch) | |
tree | 062b9bc20a9d8f9ee9be39ce30638ca0f0266cf0 /src/lib/libnetlink.c | |
parent | testing (diff) | |
parent | Compile with -W -Wall -Werror (diff) | |
download | firejail-5c0edb3435a07372bf89ef19e9730066aecc6b8c.tar.gz firejail-5c0edb3435a07372bf89ef19e9730066aecc6b8c.tar.zst firejail-5c0edb3435a07372bf89ef19e9730066aecc6b8c.zip |
Merge pull request #35 from pmillerchip/warnings-cleanup
Compile with -W -Wall -Werror
Diffstat (limited to 'src/lib/libnetlink.c')
-rw-r--r-- | src/lib/libnetlink.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/libnetlink.c b/src/lib/libnetlink.c index 264632a01..40fb099f7 100644 --- a/src/lib/libnetlink.c +++ b/src/lib/libnetlink.c | |||
@@ -363,7 +363,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, | |||
363 | fprintf(stderr, "sender address length == %d\n", msg.msg_namelen); | 363 | fprintf(stderr, "sender address length == %d\n", msg.msg_namelen); |
364 | exit(1); | 364 | exit(1); |
365 | } | 365 | } |
366 | for (h = (struct nlmsghdr*)buf; status >= sizeof(*h); ) { | 366 | for (h = (struct nlmsghdr*)buf; status >= (int)sizeof(*h); ) { |
367 | int len = h->nlmsg_len; | 367 | int len = h->nlmsg_len; |
368 | int l = len - sizeof(*h); | 368 | int l = len - sizeof(*h); |
369 | 369 | ||
@@ -376,7 +376,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, | |||
376 | exit(1); | 376 | exit(1); |
377 | } | 377 | } |
378 | 378 | ||
379 | if (nladdr.nl_pid != peer || | 379 | if ((pid_t)(nladdr.nl_pid) != peer || |
380 | h->nlmsg_pid != rtnl->local.nl_pid || | 380 | h->nlmsg_pid != rtnl->local.nl_pid || |
381 | h->nlmsg_seq != seq) { | 381 | h->nlmsg_seq != seq) { |
382 | /* Don't forget to skip that message. */ | 382 | /* Don't forget to skip that message. */ |
@@ -387,7 +387,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, | |||
387 | 387 | ||
388 | if (h->nlmsg_type == NLMSG_ERROR) { | 388 | if (h->nlmsg_type == NLMSG_ERROR) { |
389 | struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h); | 389 | struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h); |
390 | if (l < sizeof(struct nlmsgerr)) { | 390 | if (l < (int)sizeof(struct nlmsgerr)) { |
391 | fprintf(stderr, "ERROR truncated\n"); | 391 | fprintf(stderr, "ERROR truncated\n"); |
392 | } else { | 392 | } else { |
393 | if (!err->error) { | 393 | if (!err->error) { |
@@ -465,7 +465,7 @@ int rtnl_listen(struct rtnl_handle *rtnl, | |||
465 | fprintf(stderr, "Sender address length == %d\n", msg.msg_namelen); | 465 | fprintf(stderr, "Sender address length == %d\n", msg.msg_namelen); |
466 | exit(1); | 466 | exit(1); |
467 | } | 467 | } |
468 | for (h = (struct nlmsghdr*)buf; status >= sizeof(*h); ) { | 468 | for (h = (struct nlmsghdr*)buf; status >= (int)sizeof(*h); ) { |
469 | int err; | 469 | int err; |
470 | int len = h->nlmsg_len; | 470 | int len = h->nlmsg_len; |
471 | int l = len - sizeof(*h); | 471 | int l = len - sizeof(*h); |
@@ -528,7 +528,7 @@ int rtnl_from_file(FILE *rtnl, rtnl_filter_t handler, | |||
528 | len = h->nlmsg_len; | 528 | len = h->nlmsg_len; |
529 | l = len - sizeof(*h); | 529 | l = len - sizeof(*h); |
530 | 530 | ||
531 | if (l<0 || len>sizeof(buf)) { | 531 | if (l < 0 || len > (int)sizeof(buf)) { |
532 | fprintf(stderr, "!!!malformed message: len=%d @%lu\n", | 532 | fprintf(stderr, "!!!malformed message: len=%d @%lu\n", |
533 | len, ftell(rtnl)); | 533 | len, ftell(rtnl)); |
534 | return -1; | 534 | return -1; |
@@ -619,7 +619,7 @@ printf("\tdata length: %d\n", alen); | |||
619 | int len = RTA_LENGTH(alen); | 619 | int len = RTA_LENGTH(alen); |
620 | struct rtattr *rta; | 620 | struct rtattr *rta; |
621 | 621 | ||
622 | if (NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len) > maxlen) { | 622 | if ((int)(NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len)) > maxlen) { |
623 | fprintf(stderr, "addattr_l ERROR: message exceeded bound of %d\n",maxlen); | 623 | fprintf(stderr, "addattr_l ERROR: message exceeded bound of %d\n",maxlen); |
624 | return -1; | 624 | return -1; |
625 | } | 625 | } |
@@ -673,7 +673,7 @@ else | |||
673 | 673 | ||
674 | int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len) | 674 | int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len) |
675 | { | 675 | { |
676 | if (NLMSG_ALIGN(n->nlmsg_len) + NLMSG_ALIGN(len) > maxlen) { | 676 | if ((int)(NLMSG_ALIGN(n->nlmsg_len) + NLMSG_ALIGN(len)) > maxlen) { |
677 | fprintf(stderr, "addraw_l ERROR: message exceeded bound of %d\n",maxlen); | 677 | fprintf(stderr, "addraw_l ERROR: message exceeded bound of %d\n",maxlen); |
678 | return -1; | 678 | return -1; |
679 | } | 679 | } |
@@ -792,7 +792,7 @@ int parse_rtattr_byindex(struct rtattr *tb[], int max, struct rtattr *rta, int l | |||
792 | int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rtattr *rta, | 792 | int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rtattr *rta, |
793 | int len) | 793 | int len) |
794 | { | 794 | { |
795 | if (RTA_PAYLOAD(rta) < len) | 795 | if ((int)RTA_PAYLOAD(rta) < len) |
796 | return -1; | 796 | return -1; |
797 | if (RTA_PAYLOAD(rta) >= RTA_ALIGN(len) + sizeof(struct rtattr)) { | 797 | if (RTA_PAYLOAD(rta) >= RTA_ALIGN(len) + sizeof(struct rtattr)) { |
798 | rta = RTA_DATA(rta) + RTA_ALIGN(len); | 798 | rta = RTA_DATA(rta) + RTA_ALIGN(len); |