diff options
author | Denis Vlasenko | 2008-05-15 21:30:45 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-05-15 21:30:45 +0000 |
commit | 6b06cb80be64fcf207bee734cc678c25434ed1a4 (patch) | |
tree | aebc37ae3a2658fba3f57003102fa0dfb1a10ac8 /networking | |
parent | 43d5d429fd7a80ca02eb8388f058fd9654cc118d (diff) | |
download | busybox-6b06cb80be64fcf207bee734cc678c25434ed1a4.zip busybox-6b06cb80be64fcf207bee734cc678c25434ed1a4.tar.gz |
more of -Wall fixes from Cristian Ionescu-Idbohrn.
Some are fixing real bugs.
function old new delta
syslogd_main 938 958 +20
get_signum 136 143 +7
obj_load 777 782 +5
recv_from_to 210 214 +4
get_next_block 1795 1799 +4
display_topmem_process_list 1117 1121 +4
logread_main 484 487 +3
buffer_fill_and_print 73 76 +3
kill_main 687 689 +2
ll_remember_index 240 241 +1
do_stats 452 453 +1
if_readconf 166 165 -1
display_process_list 1192 1191 -1
run_applet_and_exit 507 505 -2
print_signames 33 31 -2
parse_one_line 1092 1090 -2
find_out_spec 57 55 -2
add_ksymoops_symbols 421 419 -2
ash_main 1407 1402 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 11/8 up/down: 54/-17) Total: 37 bytes
Diffstat (limited to 'networking')
-rw-r--r-- | networking/arping.c | 2 | ||||
-rw-r--r-- | networking/httpd.c | 2 | ||||
-rw-r--r-- | networking/ifenslave.c | 2 | ||||
-rw-r--r-- | networking/ifupdown.c | 6 | ||||
-rw-r--r-- | networking/inetd.c | 4 | ||||
-rw-r--r-- | networking/interface.c | 4 | ||||
-rw-r--r-- | networking/isrv_identd.c | 2 | ||||
-rw-r--r-- | networking/libiproute/libnetlink.c | 8 | ||||
-rw-r--r-- | networking/libiproute/ll_map.c | 2 | ||||
-rw-r--r-- | networking/libiproute/ll_proto.c | 6 | ||||
-rw-r--r-- | networking/libiproute/ll_types.c | 2 | ||||
-rw-r--r-- | networking/sendmail.c | 4 | ||||
-rw-r--r-- | networking/traceroute.c | 2 | ||||
-rw-r--r-- | networking/udhcp/files.c | 4 | ||||
-rw-r--r-- | networking/zcip.c | 2 |
15 files changed, 25 insertions, 27 deletions
diff --git a/networking/arping.c b/networking/arping.c index 9d2c671..2db2ff4 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -174,7 +174,7 @@ static bool recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM) if (ah->ar_pro != htons(ETH_P_IP) || (ah->ar_pln != 4) || (ah->ar_hln != me.sll_halen) - || (len < sizeof(*ah) + 2 * (4 + ah->ar_hln))) + || (len < (int)(sizeof(*ah) + 2 * (4 + ah->ar_hln)))) return false; memcpy(&src_ip, p + ah->ar_hln, 4); diff --git a/networking/httpd.c b/networking/httpd.c index 6fd322c..f835d80 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -600,7 +600,7 @@ static void parse_conf(const char *path, int flag) #if ENABLE_FEATURE_HTTPD_ERROR_PAGES if (flag == FIRST_PARSE && *p0 == 'E') { - int i; + unsigned i; /* error status code */ int status = atoi(++p0); /* c already points at the character following ':' in parse loop */ diff --git a/networking/ifenslave.c b/networking/ifenslave.c index 0aa2320..983d9d0 100644 --- a/networking/ifenslave.c +++ b/networking/ifenslave.c @@ -604,7 +604,7 @@ static int set_if_addr(char *master_ifname, char *slave_ifname) struct ifreq ifr; int res; - int i; + unsigned i; for (i = 0; i < ARRAY_SIZE(ifra); i++) { strncpy_IFNAMSIZ(ifr.ifr_name, master_ifname); diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 50b9626..c123918 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -486,7 +486,7 @@ static const struct dhcp_client_t ext_dhcp_clients[] = { #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) { - int i; + unsigned i; #if ENABLE_FEATURE_IFUPDOWN_IP /* ip doesn't up iface when it configures it (unlike ifconfig) */ if (!execute("ip link set %iface% up", ifd, exec)) @@ -522,7 +522,7 @@ static int dhcp_up(struct interface_defn_t *ifd ATTRIBUTE_UNUSED, #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) { - int i; + unsigned i; for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { if (exists_execable(ext_dhcp_clients[i].name)) return execute(ext_dhcp_clients[i].stopcmd, ifd, exec); @@ -1154,7 +1154,7 @@ int ifupdown_main(int argc, char **argv) char *liface; char *pch; bool okay = 0; - unsigned cmds_ret; + int cmds_ret; iface = xstrdup(target_list->data); target_list = target_list->link; diff --git a/networking/inetd.c b/networking/inetd.c index d71a115..3be9dcb 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -750,7 +750,7 @@ static NOINLINE servtab_t *parse_one_line(void) if (*p == '-') { p++; n = bb_strtou(p, &p, 10); - if (n > INT_MAX || n < sep->se_rpcver_lo) + if (n > INT_MAX || (int)n < sep->se_rpcver_lo) goto bad_ver_spec; sep->se_rpcver_hi = n; } @@ -812,7 +812,7 @@ static NOINLINE servtab_t *parse_one_line(void) && (sep->se_socktype == SOCK_STREAM || sep->se_socktype == SOCK_DGRAM) ) { - int i; + unsigned i; for (i = 0; i < ARRAY_SIZE(builtins); i++) if (strncmp(builtins[i].bi_service7, sep->se_service, 7) == 0) goto found_bi; diff --git a/networking/interface.c b/networking/interface.c index ee8ab10..a24ab01 100644 --- a/networking/interface.c +++ b/networking/interface.c @@ -525,7 +525,7 @@ static int if_readconf(void) if (ioctl_or_warn(skfd, SIOCGIFCONF, &ifc) < 0) { goto out; } - if (ifc.ifc_len == sizeof(struct ifreq) * numreqs) { + if (ifc.ifc_len == (int)(sizeof(struct ifreq) * numreqs)) { /* assume it overflowed and try again */ numreqs += 10; continue; @@ -862,7 +862,7 @@ const struct hwtype *get_hwntype(int type) /* return 1 if address is all zeros */ static int hw_null_address(const struct hwtype *hw, void *ap) { - unsigned int i; + int i; unsigned char *address = (unsigned char *) ap; for (i = 0; i < hw->alen; i++) diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c index a96ac60..3e05632 100644 --- a/networking/isrv_identd.c +++ b/networking/isrv_identd.c @@ -61,7 +61,7 @@ static int do_rd(int fd, void **paramp) p = strpbrk(cur, "\r\n"); if (p) *p = '\0'; - if (!p && sz && buf->pos <= sizeof(buf->buf)) + if (!p && sz && buf->pos <= (int)sizeof(buf->buf)) goto ok; /* Terminate session. If we are in server mode, then * fd is still in nonblocking mode - we never block here */ diff --git a/networking/libiproute/libnetlink.c b/networking/libiproute/libnetlink.c index d29d035..47a055a 100644 --- a/networking/libiproute/libnetlink.c +++ b/networking/libiproute/libnetlink.c @@ -265,7 +265,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, if (msg.msg_namelen != sizeof(nladdr)) { bb_error_msg_and_die("sender address length == %d", msg.msg_namelen); } - for (h = (struct nlmsghdr*)buf; status >= sizeof(*h); ) { + for (h = (struct nlmsghdr*)buf; status >= (int)sizeof(*h); ) { // int l_err; int len = h->nlmsg_len; int l = len - sizeof(*h); @@ -293,7 +293,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, if (h->nlmsg_type == NLMSG_ERROR) { struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h); - if (l < sizeof(struct nlmsgerr)) { + if (l < (int)sizeof(struct nlmsgerr)) { bb_error_msg("ERROR truncated"); } else { errno = - err->error; @@ -336,7 +336,7 @@ int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data) { int len = RTA_LENGTH(4); struct rtattr *rta; - if (NLMSG_ALIGN(n->nlmsg_len) + len > maxlen) + if ((int)(NLMSG_ALIGN(n->nlmsg_len) + len) > maxlen) return -1; rta = (struct rtattr*)(((char*)n) + NLMSG_ALIGN(n->nlmsg_len)); rta->rta_type = type; @@ -351,7 +351,7 @@ int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen) int len = RTA_LENGTH(alen); struct rtattr *rta; - if (NLMSG_ALIGN(n->nlmsg_len) + len > maxlen) + if ((int)(NLMSG_ALIGN(n->nlmsg_len) + len) > maxlen) return -1; rta = (struct rtattr*)(((char*)n) + NLMSG_ALIGN(n->nlmsg_len)); rta->rta_type = type; diff --git a/networking/libiproute/ll_map.c b/networking/libiproute/ll_map.c index 3cfc9cc..031b29a 100644 --- a/networking/libiproute/ll_map.c +++ b/networking/libiproute/ll_map.c @@ -75,7 +75,7 @@ int ll_remember_index(struct sockaddr_nl *who ATTRIBUTE_UNUSED, if (tb[IFLA_ADDRESS]) { int alen; im->alen = alen = RTA_PAYLOAD(tb[IFLA_ADDRESS]); - if (alen > sizeof(im->addr)) + if (alen > (int)sizeof(im->addr)) alen = sizeof(im->addr); memcpy(im->addr, RTA_DATA(tb[IFLA_ADDRESS]), alen); } else { diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c index 62262c9..8d96374 100644 --- a/networking/libiproute/ll_proto.c +++ b/networking/libiproute/ll_proto.c @@ -98,10 +98,8 @@ __PF(ECONET,econet) const char *ll_proto_n2a(unsigned short id, char *buf, int len) { - int i; - + unsigned i; id = ntohs(id); - for (i = 0; i < ARRAY_SIZE(llproto_names); i++) { if (llproto_names[i].id == id) return llproto_names[i].name; @@ -112,7 +110,7 @@ const char *ll_proto_n2a(unsigned short id, char *buf, int len) int ll_proto_a2n(unsigned short *id, char *buf) { - int i; + unsigned i; for (i = 0; i < ARRAY_SIZE(llproto_names); i++) { if (strcasecmp(llproto_names[i].name, buf) == 0) { *id = htons(llproto_names[i].id); diff --git a/networking/libiproute/ll_types.c b/networking/libiproute/ll_types.c index 60a78c7..50c9f20 100644 --- a/networking/libiproute/ll_types.c +++ b/networking/libiproute/ll_types.c @@ -187,7 +187,7 @@ const char *ll_type_n2a(int type, char *buf, int len) #endif /* FEATURE_IP_RARE_PROTOCOLS */ }; - int i; + unsigned i; const char *aname = arphrd_name; for (i = 0; i < ARRAY_SIZE(arphrd_type); i++) { if (arphrd_type[i] == type) diff --git a/networking/sendmail.c b/networking/sendmail.c index f37d97f..027656d 100644 --- a/networking/sendmail.c +++ b/networking/sendmail.c @@ -187,7 +187,7 @@ static int smtp_checkp(const char *fmt, const char *param, int code) bb_error_msg_and_die("%s failed", msg); } -static int inline smtp_check(const char *fmt, int code) +static inline int smtp_check(const char *fmt, int code) { return smtp_checkp(fmt, NULL, code); } @@ -224,7 +224,7 @@ static void pop3_checkr(const char *fmt, const char *param, char **ret) bb_error_msg_and_die("%s failed", msg); } -static void inline pop3_check(const char *fmt, const char *param) +static inline void pop3_check(const char *fmt, const char *param) { pop3_checkr(fmt, param, NULL); } diff --git a/networking/traceroute.c b/networking/traceroute.c index c0b4a3f..e9df275 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -413,7 +413,7 @@ ifaddrlist(struct IFADDRLIST **ipaddrp) ifc.ifc_buf = (caddr_t)ibuf; if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 - || ifc.ifc_len < sizeof(struct ifreq) + || ifc.ifc_len < (int)sizeof(struct ifreq) ) { if (errno == EINVAL) bb_error_msg_and_die( diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c index b13367d..58498f9 100644 --- a/networking/udhcp/files.c +++ b/networking/udhcp/files.c @@ -319,7 +319,7 @@ void read_config(const char *file) { FILE *in; char buffer[READ_CONFIG_BUF_SIZE], *token, *line; - int i, lineno; + unsigned i, lineno; for (i = 0; i < KWS_WITH_DEFAULTS; i++) keywords[i].handler(keywords[i].def, keywords[i].var); @@ -344,7 +344,7 @@ void read_config(const char *file) for (i = 0; i < ARRAY_SIZE(keywords); i++) { if (!strcasecmp(token, keywords[i].keyword)) { if (!keywords[i].handler(line, keywords[i].var)) { - bb_error_msg("can't parse line %d in %s at '%s'", + bb_error_msg("can't parse line %u in %s at '%s'", lineno, file, line); /* reset back to the default value */ keywords[i].handler(keywords[i].def, keywords[i].var); diff --git a/networking/zcip.c b/networking/zcip.c index 8db840c..fccb1a4 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -162,7 +162,7 @@ static int run(char *argv[3], struct in_addr *ip) /** * Return milliseconds of random delay, up to "secs" seconds. */ -static unsigned ALWAYS_INLINE random_delay_ms(unsigned secs) +static ALWAYS_INLINE unsigned random_delay_ms(unsigned secs) { return rand() % (secs * 1000); } |