aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-01-29 23:43:18 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-01-29 23:43:18 +0000
commit1a0a65f68efe01e93ef3c083c21a77dee97ca036 (patch)
tree70eab3e72843b1418ef3d88437c1f1a19169bda8
parentfc6a03ef2fa63dcecef603d178139a779b9e7081 (diff)
downloadbusybox-w32-1a0a65f68efe01e93ef3c083c21a77dee97ca036.tar.gz
busybox-w32-1a0a65f68efe01e93ef3c083c21a77dee97ca036.tar.bz2
busybox-w32-1a0a65f68efe01e93ef3c083c21a77dee97ca036.zip
preparatory patch for -Wwrite-strings #5
git-svn-id: svn://busybox.net/trunk/busybox@17658 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--miscutils/devfsd.c41
-rw-r--r--miscutils/mt.c2
-rw-r--r--miscutils/nmeter.c4
-rw-r--r--networking/ifupdown.c24
-rw-r--r--networking/libiproute/ip_common.h3
-rw-r--r--networking/libiproute/ip_parse_common_args.c2
-rw-r--r--networking/libiproute/iplink.c2
-rw-r--r--networking/libiproute/iproute.c16
-rw-r--r--networking/libiproute/utils.h3
-rw-r--r--networking/ping.c6
-rw-r--r--networking/zcip.c6
11 files changed, 49 insertions, 60 deletions
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index 5435a6a0b..7c604f604 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -242,7 +242,7 @@ static const char *expand_variable( char *, unsigned, unsigned *, const char *,
242 const char *(*) (const char *, void *), void * ); 242 const char *(*) (const char *, void *), void * );
243static const char *get_variable_v2(const char *, const char *(*) (const char *, void *), void *); 243static const char *get_variable_v2(const char *, const char *(*) (const char *, void *), void *);
244static char get_old_ide_name (unsigned , unsigned); 244static char get_old_ide_name (unsigned , unsigned);
245static char *write_old_sd_name (char *, unsigned, unsigned, char *); 245static char *write_old_sd_name (char *, unsigned, unsigned, const char *);
246 246
247/* busybox functions */ 247/* busybox functions */
248static void msg_logger(int pri, const char * fmt, ... )__attribute__ ((format (printf, 2, 3))); 248static void msg_logger(int pri, const char * fmt, ... )__attribute__ ((format (printf, 2, 3)));
@@ -262,8 +262,8 @@ static volatile int caught_signal = FALSE;
262static volatile int caught_sighup = FALSE; 262static volatile int caught_sighup = FALSE;
263static struct initial_symlink_struct 263static struct initial_symlink_struct
264{ 264{
265 char *dest; 265 const char *dest;
266 char *name; 266 const char *name;
267} initial_symlinks[] = 267} initial_symlinks[] =
268{ 268{
269 {"/proc/self/fd", "fd"}, 269 {"/proc/self/fd", "fd"},
@@ -479,9 +479,8 @@ int devfsd_main (int argc, char **argv)
479 479
480 /* NB: The check for CONFIG_FILE is done in read_config_file() */ 480 /* NB: The check for CONFIG_FILE is done in read_config_file() */
481 481
482 if ( print_version || (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev) ) 482 if (print_version || (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev)) {
483 { 483 printf("%s v%s\nDaemon %s:\t%d\nKernel-side %s:\t%d\n",
484 printf( "%s v%s\nDaemon %s:\t%d\nKernel-side %s:\t%d\n",
485 applet_name,DEVFSD_VERSION,bb_msg_proto_rev, 484 applet_name,DEVFSD_VERSION,bb_msg_proto_rev,
486 DEVFSD_PROTOCOL_REVISION_DAEMON,bb_msg_proto_rev, proto_rev); 485 DEVFSD_PROTOCOL_REVISION_DAEMON,bb_msg_proto_rev, proto_rev);
487 if (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev) 486 if (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev)
@@ -491,19 +490,19 @@ int devfsd_main (int argc, char **argv)
491 /* Tell kernel we are special (i.e. we get to see hidden entries) */ 490 /* Tell kernel we are special (i.e. we get to see hidden entries) */
492 do_ioctl_and_die(fd, DEVFSDIOC_SET_EVENT_MASK, 0); 491 do_ioctl_and_die(fd, DEVFSDIOC_SET_EVENT_MASK, 0);
493 492
494 sigemptyset (&new_action.sa_mask); 493 sigemptyset(&new_action.sa_mask);
495 new_action.sa_flags = 0; 494 new_action.sa_flags = 0;
496 495
497 /* Set up SIGHUP and SIGUSR1 handlers */ 496 /* Set up SIGHUP and SIGUSR1 handlers */
498 new_action.sa_handler = signal_handler; 497 new_action.sa_handler = signal_handler;
499 if (sigaction (SIGHUP, &new_action, NULL) != 0 || sigaction (SIGUSR1, &new_action, NULL) != 0 ) 498 if (sigaction(SIGHUP, &new_action, NULL) != 0 || sigaction (SIGUSR1, &new_action, NULL) != 0 )
500 devfsd_error_msg_and_die( "sigaction"); 499 devfsd_error_msg_and_die( "sigaction");
501 500
502 printf("%s v%s started for %s\n",applet_name, DEVFSD_VERSION, mount_point); 501 printf("%s v%s started for %s\n",applet_name, DEVFSD_VERSION, mount_point);
503 502
504 /* Set umask so that mknod(2), open(2) and mkdir(2) have complete control over permissions */ 503 /* Set umask so that mknod(2), open(2) and mkdir(2) have complete control over permissions */
505 umask (0); 504 umask(0);
506 read_config_file (CONFIG_FILE, FALSE, &event_mask); 505 read_config_file((char*)CONFIG_FILE, FALSE, &event_mask);
507 /* Do the scan before forking, so that boot scripts see the finished product */ 506 /* Do the scan before forking, so that boot scripts see the finished product */
508 dir_operation(SERVICE,mount_point,0,NULL); 507 dir_operation(SERVICE,mount_point,0,NULL);
509 508
@@ -524,7 +523,7 @@ int devfsd_main (int argc, char **argv)
524 do_scan = do_servicing (fd, event_mask); 523 do_scan = do_servicing (fd, event_mask);
525 524
526 free_config (); 525 free_config ();
527 read_config_file (CONFIG_FILE, FALSE, &event_mask); 526 read_config_file ((char*)CONFIG_FILE, FALSE, &event_mask);
528 if (do_scan) 527 if (do_scan)
529 dir_operation(SERVICE,mount_point,0,NULL); 528 dir_operation(SERVICE,mount_point,0,NULL);
530 } 529 }
@@ -545,7 +544,7 @@ static void read_config_file (char *path, int optional, unsigned long *event_mas
545 struct stat statbuf; 544 struct stat statbuf;
546 FILE *fp; 545 FILE *fp;
547 char buf[STRING_LENGTH]; 546 char buf[STRING_LENGTH];
548 char *line=NULL; 547 char *line = NULL;
549 548
550 debug_msg_logger(LOG_INFO, "%s: %s", __FUNCTION__, path); 549 debug_msg_logger(LOG_INFO, "%s: %s", __FUNCTION__, path);
551 550
@@ -598,7 +597,7 @@ static void process_config_line (const char *line, unsigned long *event_mask)
598 char p[MAX_ARGS][STRING_LENGTH]; 597 char p[MAX_ARGS][STRING_LENGTH];
599 char when[STRING_LENGTH], what[STRING_LENGTH]; 598 char when[STRING_LENGTH], what[STRING_LENGTH];
600 char name[STRING_LENGTH]; 599 char name[STRING_LENGTH];
601 char * msg=""; 600 const char *msg = "";
602 char *ptr; 601 char *ptr;
603 int i; 602 int i;
604 603
@@ -876,10 +875,10 @@ static void action_modload (const struct devfsd_notify_struct *info,
876 char *argv[6]; 875 char *argv[6];
877 char device[STRING_LENGTH]; 876 char device[STRING_LENGTH];
878 877
879 argv[0] = MODPROBE; 878 argv[0] = (char*)MODPROBE;
880 argv[1] = MODPROBE_SWITCH_1; /* "-k" */ 879 argv[1] = (char*)MODPROBE_SWITCH_1; /* "-k" */
881 argv[2] = MODPROBE_SWITCH_2; /* "-C" */ 880 argv[2] = (char*)MODPROBE_SWITCH_2; /* "-C" */
882 argv[3] = CONFIG_MODULES_DEVFS; 881 argv[3] = (char*)CONFIG_MODULES_DEVFS;
883 argv[4] = device; 882 argv[4] = device;
884 argv[5] = NULL; 883 argv[5] = NULL;
885 884
@@ -1221,7 +1220,7 @@ static int get_uid_gid (int flag, const char *string)
1221{ 1220{
1222 struct passwd *pw_ent; 1221 struct passwd *pw_ent;
1223 struct group *grp_ent; 1222 struct group *grp_ent;
1224 static char *msg; 1223 static const char *msg;
1225 1224
1226 if (ENABLE_DEVFSD_VERBOSE) 1225 if (ENABLE_DEVFSD_VERBOSE)
1227 msg="user"; 1226 msg="user";
@@ -1532,8 +1531,8 @@ static void expand_regexp (char *output, size_t outsize, const char *input,
1532 1531
1533struct translate_struct 1532struct translate_struct
1534{ 1533{
1535 char *match; /* The string to match to (up to length) */ 1534 const char *match; /* The string to match to (up to length) */
1536 char *format; /* Format of output, "%s" takes data past match string, 1535 const char *format; /* Format of output, "%s" takes data past match string,
1537 NULL is effectively "%s" (just more efficient) */ 1536 NULL is effectively "%s" (just more efficient) */
1538}; 1537};
1539 1538
@@ -1719,7 +1718,7 @@ static char get_old_ide_name (unsigned int major, unsigned int minor)
1719 1718
1720static char *write_old_sd_name (char *buffer, 1719static char *write_old_sd_name (char *buffer,
1721 unsigned int major, unsigned int minor, 1720 unsigned int major, unsigned int minor,
1722 char *part) 1721 const char *part)
1723/* [SUMMARY] Write the old SCSI disc name to a buffer. 1722/* [SUMMARY] Write the old SCSI disc name to a buffer.
1724 <buffer> The buffer to write to. 1723 <buffer> The buffer to write to.
1725 <major> The major number for the device. 1724 <major> The major number for the device.
diff --git a/miscutils/mt.c b/miscutils/mt.c
index 9ecec82a1..a4b527f1b 100644
--- a/miscutils/mt.c
+++ b/miscutils/mt.c
@@ -7,7 +7,7 @@
7#include <sys/mtio.h> 7#include <sys/mtio.h>
8 8
9struct mt_opcodes { 9struct mt_opcodes {
10 char *name; 10 const char *name;
11 short value; 11 short value;
12}; 12};
13 13
diff --git a/miscutils/nmeter.c b/miscutils/nmeter.c
index 1fa35b293..966131af5 100644
--- a/miscutils/nmeter.c
+++ b/miscutils/nmeter.c
@@ -20,7 +20,7 @@ typedef unsigned long long ullong;
20enum { proc_file_size = 4096 }; 20enum { proc_file_size = 4096 };
21 21
22typedef struct proc_file { 22typedef struct proc_file {
23 char *name; 23 const char *name;
24 int gen; 24 int gen;
25 char *file; 25 char *file;
26} proc_file; 26} proc_file;
@@ -38,7 +38,7 @@ static struct timeval tv;
38static int delta = 1000000; 38static int delta = 1000000;
39static int deltanz = 1000000; 39static int deltanz = 1000000;
40static int need_seconds = 0; 40static int need_seconds = 0;
41static char *final_str = "\n"; 41static const char *final_str = "\n";
42 42
43// We depend on this being a char[], not char* - we take sizeof() of it 43// We depend on this being a char[], not char* - we take sizeof() of it
44#define outbuf bb_common_bufsiz1 44#define outbuf bb_common_bufsiz1
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 4ec3d37a8..834c7fa7d 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -36,22 +36,19 @@ struct interface_defn_t;
36 36
37typedef int execfn(char *command); 37typedef int execfn(char *command);
38 38
39struct method_t 39struct method_t {
40{ 40 const char *name;
41 char *name;
42 int (*up)(struct interface_defn_t *ifd, execfn *e); 41 int (*up)(struct interface_defn_t *ifd, execfn *e);
43 int (*down)(struct interface_defn_t *ifd, execfn *e); 42 int (*down)(struct interface_defn_t *ifd, execfn *e);
44}; 43};
45 44
46struct address_family_t 45struct address_family_t {
47{ 46 const char *name;
48 char *name;
49 int n_methods; 47 int n_methods;
50 const struct method_t *method; 48 const struct method_t *method;
51}; 49};
52 50
53struct mapping_defn_t 51struct mapping_defn_t {
54{
55 struct mapping_defn_t *next; 52 struct mapping_defn_t *next;
56 53
57 int max_matches; 54 int max_matches;
@@ -65,14 +62,12 @@ struct mapping_defn_t
65 char **mapping; 62 char **mapping;
66}; 63};
67 64
68struct variable_t 65struct variable_t {
69{
70 char *name; 66 char *name;
71 char *value; 67 char *value;
72}; 68};
73 69
74struct interface_defn_t 70struct interface_defn_t {
75{
76 const struct address_family_t *address_family; 71 const struct address_family_t *address_family;
77 const struct method_t *method; 72 const struct method_t *method;
78 73
@@ -82,8 +77,7 @@ struct interface_defn_t
82 struct variable_t *option; 77 struct variable_t *option;
83}; 78};
84 79
85struct interfaces_file_t 80struct interfaces_file_t {
86{
87 llist_t *autointerfaces; 81 llist_t *autointerfaces;
88 llist_t *ifaces; 82 llist_t *ifaces;
89 struct mapping_defn_t *mappings; 83 struct mapping_defn_t *mappings;
@@ -105,7 +99,7 @@ enum {
105 99
106static char **my_environ; 100static char **my_environ;
107 101
108static char *startup_PATH; 102static const char *startup_PATH;
109 103
110#if ENABLE_FEATURE_IFUPDOWN_IPV4 || ENABLE_FEATURE_IFUPDOWN_IPV6 104#if ENABLE_FEATURE_IFUPDOWN_IPV4 || ENABLE_FEATURE_IFUPDOWN_IPV6
111 105
diff --git a/networking/libiproute/ip_common.h b/networking/libiproute/ip_common.h
index 15291780e..05a6a95f5 100644
--- a/networking/libiproute/ip_common.h
+++ b/networking/libiproute/ip_common.h
@@ -14,7 +14,8 @@
14#endif 14#endif
15 15
16extern int preferred_family; 16extern int preferred_family;
17extern char * _SL_; 17//FIXME! Appears in two .h files!
18extern const char * _SL_;
18 19
19extern void ip_parse_common_args(int *argcp, char ***argvp); 20extern void ip_parse_common_args(int *argcp, char ***argvp);
20extern int print_neigh(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); 21extern int print_neigh(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);
diff --git a/networking/libiproute/ip_parse_common_args.c b/networking/libiproute/ip_parse_common_args.c
index 64386c9dd..00a891232 100644
--- a/networking/libiproute/ip_parse_common_args.c
+++ b/networking/libiproute/ip_parse_common_args.c
@@ -24,7 +24,7 @@
24 24
25int preferred_family = AF_UNSPEC; 25int preferred_family = AF_UNSPEC;
26int oneline = 0; 26int oneline = 0;
27char * _SL_ = NULL; 27const char * _SL_ = NULL;
28 28
29void ip_parse_common_args(int *argcp, char ***argvp) 29void ip_parse_common_args(int *argcp, char ***argvp)
30{ 30{
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index ae41ab308..cb6ee962b 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -25,7 +25,7 @@
25/* take from linux/sockios.h */ 25/* take from linux/sockios.h */
26#define SIOCSIFNAME 0x8923 /* set interface name */ 26#define SIOCSIFNAME 0x8923 /* set interface name */
27 27
28static int on_off(char *msg) 28static int on_off(const char *msg)
29{ 29{
30 bb_error_msg("error: argument of \"%s\" must be \"on\" or \"off\"", msg); 30 bb_error_msg("error: argument of \"%s\" must be \"on\" or \"off\"", msg);
31 return -1; 31 return -1;
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index c8a58c11c..27d37ac79 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -469,21 +469,15 @@ static int rtnl_rtcache_request(struct rtnl_handle *rth, int family)
469 469
470static int iproute_flush_cache(void) 470static int iproute_flush_cache(void)
471{ 471{
472#define ROUTE_FLUSH_PATH "/proc/sys/net/ipv4/route/flush" 472 static const char fn[] = "/proc/sys/net/ipv4/route/flush";
473 473 int flush_fd = open(fn, O_WRONLY);
474 int len;
475 int flush_fd = open (ROUTE_FLUSH_PATH, O_WRONLY);
476 char *buffer = "-1";
477
478 if (flush_fd < 0) { 474 if (flush_fd < 0) {
479 fprintf(stderr, "Cannot open \"%s\"\n", ROUTE_FLUSH_PATH); 475 bb_perror_msg("cannot open '%s'", fn);
480 return -1; 476 return -1;
481 } 477 }
482 478
483 len = strlen (buffer); 479 if (write(flush_fd, "-1", 2) < 2) {
484 480 bb_perror_msg("cannot flush routing cache");
485 if ((write (flush_fd, (void *)buffer, len)) < len) {
486 fprintf(stderr, "Cannot flush routing cache\n");
487 return -1; 481 return -1;
488 } 482 }
489 close(flush_fd); 483 close(flush_fd);
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h
index ebf2af194..556541f79 100644
--- a/networking/libiproute/utils.h
+++ b/networking/libiproute/utils.h
@@ -14,7 +14,8 @@ extern int show_details;
14extern int show_raw; 14extern int show_raw;
15extern int resolve_hosts; 15extern int resolve_hosts;
16extern int oneline; 16extern int oneline;
17extern char * _SL_; 17//FIXME! Appears in two .h files!
18extern const char * _SL_;
18 19
19#ifndef IPPROTO_ESP 20#ifndef IPPROTO_ESP
20#define IPPROTO_ESP 50 21#define IPPROTO_ESP 50
diff --git a/networking/ping.c b/networking/ping.c
index 52e48867e..53aabb6d7 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -369,7 +369,7 @@ static void sendping6(int junk ATTRIBUTE_UNUSED)
369} 369}
370#endif 370#endif
371 371
372static char *icmp_type_name(int id) 372static const char *icmp_type_name(int id)
373{ 373{
374 switch (id) { 374 switch (id) {
375 case ICMP_ECHOREPLY: return "Echo Reply"; 375 case ICMP_ECHOREPLY: return "Echo Reply";
@@ -400,7 +400,7 @@ static char *icmp_type_name(int id)
400#ifndef MLD_LISTENER_REDUCTION 400#ifndef MLD_LISTENER_REDUCTION
401# define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION 401# define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION
402#endif 402#endif
403static char *icmp6_type_name(int id) 403static const char *icmp6_type_name(int id)
404{ 404{
405 switch (id) { 405 switch (id) {
406 case ICMP6_DST_UNREACH: return "Destination Unreachable"; 406 case ICMP6_DST_UNREACH: return "Destination Unreachable";
@@ -761,7 +761,7 @@ int ping_main(int argc, char **argv)
761#if ENABLE_PING6 761#if ENABLE_PING6
762int ping6_main(int argc, char **argv) 762int ping6_main(int argc, char **argv)
763{ 763{
764 argv[0] = "-6"; 764 argv[0] = (char*)"-6";
765 return ping_main(argc + 1, argv - 1); 765 return ping_main(argc + 1, argv - 1);
766} 766}
767#endif 767#endif
diff --git a/networking/zcip.c b/networking/zcip.c
index 5d57c4287..b56870652 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -130,10 +130,10 @@ static void arp(int fd, struct sockaddr *saddr, int op,
130/** 130/**
131 * Run a script. 131 * Run a script.
132 */ 132 */
133static int run(char *script, char *arg, char *intf, struct in_addr *ip) 133static int run(const char *script, const char *arg, const char *intf, struct in_addr *ip)
134{ 134{
135 int pid, status; 135 int pid, status;
136 char *why; 136 const char *why;
137 137
138 if(1) { //always true: if (script != NULL) 138 if(1) { //always true: if (script != NULL)
139 VDBG("%s run %s %s\n", intf, script, arg); 139 VDBG("%s run %s %s\n", intf, script, arg);
@@ -207,7 +207,7 @@ static int state = PROBE;
207int zcip_main(int argc, char *argv[]) 207int zcip_main(int argc, char *argv[])
208{ 208{
209 struct ether_addr eth_addr; 209 struct ether_addr eth_addr;
210 char *why; 210 const char *why;
211 int fd; 211 int fd;
212 212
213 // parse commandline: prog [options] ifname script 213 // parse commandline: prog [options] ifname script