diff options
author | Rob Landley <rob@landley.net> | 2006-02-22 17:01:00 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-02-22 17:01:00 +0000 |
commit | 0a7c8ef6e220b5f8fff4f2cb0af630255a2a6a58 (patch) | |
tree | f32eb89325299a3abade721ffe149b0e516747c1 /networking | |
parent | fb16d5c6aa8aef30d313356b5a83ef0a60114c9a (diff) | |
download | busybox-w32-0a7c8ef6e220b5f8fff4f2cb0af630255a2a6a58.tar.gz busybox-w32-0a7c8ef6e220b5f8fff4f2cb0af630255a2a6a58.tar.bz2 busybox-w32-0a7c8ef6e220b5f8fff4f2cb0af630255a2a6a58.zip |
Patch from Denis Vlasenko to constify things and fix a few typos.
Diffstat (limited to 'networking')
-rw-r--r-- | networking/libiproute/ipaddress.c | 23 | ||||
-rw-r--r-- | networking/udhcp/packet.c | 7 |
2 files changed, 19 insertions, 11 deletions
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index 9db79eacb..d7a0c5177 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c | |||
@@ -416,7 +416,8 @@ static void ipaddr_reset_filter(int _oneline) | |||
416 | 416 | ||
417 | extern int ipaddr_list_or_flush(int argc, char **argv, int flush) | 417 | extern int ipaddr_list_or_flush(int argc, char **argv, int flush) |
418 | { | 418 | { |
419 | const char *option[] = { "to", "scope", "up", "label", "dev", 0 }; | 419 | static const char *const option[] = { "to", "scope", "up", "label", "dev", 0 }; |
420 | |||
420 | struct nlmsg_list *linfo = NULL; | 421 | struct nlmsg_list *linfo = NULL; |
421 | struct nlmsg_list *ainfo = NULL; | 422 | struct nlmsg_list *ainfo = NULL; |
422 | struct nlmsg_list *l; | 423 | struct nlmsg_list *l; |
@@ -499,7 +500,7 @@ extern int ipaddr_list_or_flush(int argc, char **argv, int flush) | |||
499 | if (filter_dev) { | 500 | if (filter_dev) { |
500 | filter.ifindex = ll_name_to_index(filter_dev); | 501 | filter.ifindex = ll_name_to_index(filter_dev); |
501 | if (filter.ifindex <= 0) { | 502 | if (filter.ifindex <= 0) { |
502 | bb_error_msg("Device \"%s\" does not exist.", filter_dev); | 503 | bb_error_msg("Device \"%s\" does not exist", filter_dev); |
503 | return -1; | 504 | return -1; |
504 | } | 505 | } |
505 | } | 506 | } |
@@ -631,8 +632,11 @@ static int default_scope(inet_prefix *lcl) | |||
631 | 632 | ||
632 | static int ipaddr_modify(int cmd, int argc, char **argv) | 633 | static int ipaddr_modify(int cmd, int argc, char **argv) |
633 | { | 634 | { |
634 | const char *option[] = { "peer", "remote", "broadcast", "brd", | 635 | static const char *const option[] = { |
635 | "anycast", "scope", "dev", "label", "local", 0 }; | 636 | "peer", "remote", "broadcast", "brd", |
637 | "anycast", "scope", "dev", "label", "local", 0 | ||
638 | }; | ||
639 | |||
636 | struct rtnl_handle rth; | 640 | struct rtnl_handle rth; |
637 | struct { | 641 | struct { |
638 | struct nlmsghdr n; | 642 | struct nlmsghdr n; |
@@ -716,7 +720,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv) | |||
716 | uint32_t scope = 0; | 720 | uint32_t scope = 0; |
717 | NEXT_ARG(); | 721 | NEXT_ARG(); |
718 | if (rtnl_rtscope_a2n(&scope, *argv)) { | 722 | if (rtnl_rtscope_a2n(&scope, *argv)) { |
719 | invarg(*argv, "invalid scope value."); | 723 | invarg(*argv, "invalid scope value"); |
720 | } | 724 | } |
721 | req.ifa.ifa_scope = scope; | 725 | req.ifa.ifa_scope = scope; |
722 | scoped = 1; | 726 | scoped = 1; |
@@ -749,11 +753,11 @@ static int ipaddr_modify(int cmd, int argc, char **argv) | |||
749 | } | 753 | } |
750 | 754 | ||
751 | if (d == NULL) { | 755 | if (d == NULL) { |
752 | bb_error_msg("Not enough information: \"dev\" argument is required."); | 756 | bb_error_msg("Not enough information: \"dev\" argument is required"); |
753 | return -1; | 757 | return -1; |
754 | } | 758 | } |
755 | if (l && matches(d, l) != 0) { | 759 | if (l && matches(d, l) != 0) { |
756 | bb_error_msg_and_die("\"dev\" (%s) must match \"label\" (%s).", d, l); | 760 | bb_error_msg_and_die("\"dev\" (%s) must match \"label\" (%s)", d, l); |
757 | } | 761 | } |
758 | 762 | ||
759 | if (peer_len == 0 && local_len && cmd != RTM_DELADDR) { | 763 | if (peer_len == 0 && local_len && cmd != RTM_DELADDR) { |
@@ -803,7 +807,10 @@ static int ipaddr_modify(int cmd, int argc, char **argv) | |||
803 | 807 | ||
804 | extern int do_ipaddr(int argc, char **argv) | 808 | extern int do_ipaddr(int argc, char **argv) |
805 | { | 809 | { |
806 | const char *commands[] = { "add", "delete", "list", "show", "lst", "flush", 0 }; | 810 | static const char *const commands[] = { |
811 | "add", "delete", "list", "show", "lst", "flush", 0 | ||
812 | }; | ||
813 | |||
807 | int command_num = 2; | 814 | int command_num = 2; |
808 | 815 | ||
809 | if (*argv) { | 816 | if (*argv) { |
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c index 222dd24e0..fe74b828f 100644 --- a/networking/udhcp/packet.c +++ b/networking/udhcp/packet.c | |||
@@ -46,12 +46,13 @@ void init_header(struct dhcpMessage *packet, char type) | |||
46 | /* read a packet from socket fd, return -1 on read error, -2 on packet error */ | 46 | /* read a packet from socket fd, return -1 on read error, -2 on packet error */ |
47 | int get_packet(struct dhcpMessage *packet, int fd) | 47 | int get_packet(struct dhcpMessage *packet, int fd) |
48 | { | 48 | { |
49 | int bytes; | 49 | static const char broken_vendors[][8] = { |
50 | int i; | ||
51 | const char broken_vendors[][8] = { | ||
52 | "MSFT 98", | 50 | "MSFT 98", |
53 | "" | 51 | "" |
54 | }; | 52 | }; |
53 | |||
54 | int bytes; | ||
55 | int i; | ||
55 | char unsigned *vendor; | 56 | char unsigned *vendor; |
56 | 57 | ||
57 | memset(packet, 0, sizeof(struct dhcpMessage)); | 58 | memset(packet, 0, sizeof(struct dhcpMessage)); |