summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 5435a6a..7c604f6 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -242,7 +242,7 @@ static const char *expand_variable( char *, unsigned, unsigned *, const char *,
const char *(*) (const char *, void *), void * );
static const char *get_variable_v2(const char *, const char *(*) (const char *, void *), void *);
static char get_old_ide_name (unsigned , unsigned);
-static char *write_old_sd_name (char *, unsigned, unsigned, char *);
+static char *write_old_sd_name (char *, unsigned, unsigned, const char *);
/* busybox functions */
static void msg_logger(int pri, const char * fmt, ... )__attribute__ ((format (printf, 2, 3)));
@@ -262,8 +262,8 @@ static volatile int caught_signal = FALSE;
static volatile int caught_sighup = FALSE;
static struct initial_symlink_struct
{
- char *dest;
- char *name;
+ const char *dest;
+ const char *name;
} initial_symlinks[] =
{
{"/proc/self/fd", "fd"},
@@ -479,9 +479,8 @@ int devfsd_main (int argc, char **argv)
/* NB: The check for CONFIG_FILE is done in read_config_file() */
- if ( print_version || (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev) )
- {
- printf( "%s v%s\nDaemon %s:\t%d\nKernel-side %s:\t%d\n",
+ if (print_version || (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev)) {
+ printf("%s v%s\nDaemon %s:\t%d\nKernel-side %s:\t%d\n",
applet_name,DEVFSD_VERSION,bb_msg_proto_rev,
DEVFSD_PROTOCOL_REVISION_DAEMON,bb_msg_proto_rev, proto_rev);
if (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev)
@@ -491,19 +490,19 @@ int devfsd_main (int argc, char **argv)
/* Tell kernel we are special (i.e. we get to see hidden entries) */
do_ioctl_and_die(fd, DEVFSDIOC_SET_EVENT_MASK, 0);
- sigemptyset (&new_action.sa_mask);
+ sigemptyset(&new_action.sa_mask);
new_action.sa_flags = 0;
/* Set up SIGHUP and SIGUSR1 handlers */
new_action.sa_handler = signal_handler;
- if (sigaction (SIGHUP, &new_action, NULL) != 0 || sigaction (SIGUSR1, &new_action, NULL) != 0 )
+ if (sigaction(SIGHUP, &new_action, NULL) != 0 || sigaction (SIGUSR1, &new_action, NULL) != 0 )
devfsd_error_msg_and_die( "sigaction");
printf("%s v%s started for %s\n",applet_name, DEVFSD_VERSION, mount_point);
/* Set umask so that mknod(2), open(2) and mkdir(2) have complete control over permissions */
- umask (0);
- read_config_file (CONFIG_FILE, FALSE, &event_mask);
+ umask(0);
+ read_config_file((char*)CONFIG_FILE, FALSE, &event_mask);
/* Do the scan before forking, so that boot scripts see the finished product */
dir_operation(SERVICE,mount_point,0,NULL);
@@ -524,7 +523,7 @@ int devfsd_main (int argc, char **argv)
do_scan = do_servicing (fd, event_mask);
free_config ();
- read_config_file (CONFIG_FILE, FALSE, &event_mask);
+ read_config_file ((char*)CONFIG_FILE, FALSE, &event_mask);
if (do_scan)
dir_operation(SERVICE,mount_point,0,NULL);
}
@@ -545,7 +544,7 @@ static void read_config_file (char *path, int optional, unsigned long *event_mas
struct stat statbuf;
FILE *fp;
char buf[STRING_LENGTH];
- char *line=NULL;
+ char *line = NULL;
debug_msg_logger(LOG_INFO, "%s: %s", __FUNCTION__, path);
@@ -598,7 +597,7 @@ static void process_config_line (const char *line, unsigned long *event_mask)
char p[MAX_ARGS][STRING_LENGTH];
char when[STRING_LENGTH], what[STRING_LENGTH];
char name[STRING_LENGTH];
- char * msg="";
+ const char *msg = "";
char *ptr;
int i;
@@ -876,10 +875,10 @@ static void action_modload (const struct devfsd_notify_struct *info,
char *argv[6];
char device[STRING_LENGTH];
- argv[0] = MODPROBE;
- argv[1] = MODPROBE_SWITCH_1; /* "-k" */
- argv[2] = MODPROBE_SWITCH_2; /* "-C" */
- argv[3] = CONFIG_MODULES_DEVFS;
+ argv[0] = (char*)MODPROBE;
+ argv[1] = (char*)MODPROBE_SWITCH_1; /* "-k" */
+ argv[2] = (char*)MODPROBE_SWITCH_2; /* "-C" */
+ argv[3] = (char*)CONFIG_MODULES_DEVFS;
argv[4] = device;
argv[5] = NULL;
@@ -1221,7 +1220,7 @@ static int get_uid_gid (int flag, const char *string)
{
struct passwd *pw_ent;
struct group *grp_ent;
- static char *msg;
+ static const char *msg;
if (ENABLE_DEVFSD_VERBOSE)
msg="user";
@@ -1532,8 +1531,8 @@ static void expand_regexp (char *output, size_t outsize, const char *input,
struct translate_struct
{
- char *match; /* The string to match to (up to length) */
- char *format; /* Format of output, "%s" takes data past match string,
+ const char *match; /* The string to match to (up to length) */
+ const char *format; /* Format of output, "%s" takes data past match string,
NULL is effectively "%s" (just more efficient) */
};
@@ -1719,7 +1718,7 @@ static char get_old_ide_name (unsigned int major, unsigned int minor)
static char *write_old_sd_name (char *buffer,
unsigned int major, unsigned int minor,
- char *part)
+ const char *part)
/* [SUMMARY] Write the old SCSI disc name to a buffer.
<buffer> The buffer to write to.
<major> The major number for the device.
diff --git a/miscutils/mt.c b/miscutils/mt.c
index 9ecec82..a4b527f 100644
--- a/miscutils/mt.c
+++ b/miscutils/mt.c
@@ -7,7 +7,7 @@
#include <sys/mtio.h>
struct mt_opcodes {
- char *name;
+ const char *name;
short value;
};
diff --git a/miscutils/nmeter.c b/miscutils/nmeter.c
index 1fa35b2..966131a 100644
--- a/miscutils/nmeter.c
+++ b/miscutils/nmeter.c
@@ -20,7 +20,7 @@ typedef unsigned long long ullong;
enum { proc_file_size = 4096 };
typedef struct proc_file {
- char *name;
+ const char *name;
int gen;
char *file;
} proc_file;
@@ -38,7 +38,7 @@ static struct timeval tv;
static int delta = 1000000;
static int deltanz = 1000000;
static int need_seconds = 0;
-static char *final_str = "\n";
+static const char *final_str = "\n";
// We depend on this being a char[], not char* - we take sizeof() of it
#define outbuf bb_common_bufsiz1
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 4ec3d37..834c7fa 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -36,22 +36,19 @@ struct interface_defn_t;
typedef int execfn(char *command);
-struct method_t
-{
- char *name;
+struct method_t {
+ const char *name;
int (*up)(struct interface_defn_t *ifd, execfn *e);
int (*down)(struct interface_defn_t *ifd, execfn *e);
};
-struct address_family_t
-{
- char *name;
+struct address_family_t {
+ const char *name;
int n_methods;
const struct method_t *method;
};
-struct mapping_defn_t
-{
+struct mapping_defn_t {
struct mapping_defn_t *next;
int max_matches;
@@ -65,14 +62,12 @@ struct mapping_defn_t
char **mapping;
};
-struct variable_t
-{
+struct variable_t {
char *name;
char *value;
};
-struct interface_defn_t
-{
+struct interface_defn_t {
const struct address_family_t *address_family;
const struct method_t *method;
@@ -82,8 +77,7 @@ struct interface_defn_t
struct variable_t *option;
};
-struct interfaces_file_t
-{
+struct interfaces_file_t {
llist_t *autointerfaces;
llist_t *ifaces;
struct mapping_defn_t *mappings;
@@ -105,7 +99,7 @@ enum {
static char **my_environ;
-static char *startup_PATH;
+static const char *startup_PATH;
#if ENABLE_FEATURE_IFUPDOWN_IPV4 || ENABLE_FEATURE_IFUPDOWN_IPV6
diff --git a/networking/libiproute/ip_common.h b/networking/libiproute/ip_common.h
index 1529178..05a6a95 100644
--- a/networking/libiproute/ip_common.h
+++ b/networking/libiproute/ip_common.h
@@ -14,7 +14,8 @@
#endif
extern int preferred_family;
-extern char * _SL_;
+//FIXME! Appears in two .h files!
+extern const char * _SL_;
extern void ip_parse_common_args(int *argcp, char ***argvp);
extern 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 64386c9..00a8912 100644
--- a/networking/libiproute/ip_parse_common_args.c
+++ b/networking/libiproute/ip_parse_common_args.c
@@ -24,7 +24,7 @@
int preferred_family = AF_UNSPEC;
int oneline = 0;
-char * _SL_ = NULL;
+const char * _SL_ = NULL;
void ip_parse_common_args(int *argcp, char ***argvp)
{
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index ae41ab3..cb6ee96 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -25,7 +25,7 @@
/* take from linux/sockios.h */
#define SIOCSIFNAME 0x8923 /* set interface name */
-static int on_off(char *msg)
+static int on_off(const char *msg)
{
bb_error_msg("error: argument of \"%s\" must be \"on\" or \"off\"", msg);
return -1;
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index c8a58c1..27d37ac 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)
static int iproute_flush_cache(void)
{
-#define ROUTE_FLUSH_PATH "/proc/sys/net/ipv4/route/flush"
-
- int len;
- int flush_fd = open (ROUTE_FLUSH_PATH, O_WRONLY);
- char *buffer = "-1";
-
+ static const char fn[] = "/proc/sys/net/ipv4/route/flush";
+ int flush_fd = open(fn, O_WRONLY);
if (flush_fd < 0) {
- fprintf(stderr, "Cannot open \"%s\"\n", ROUTE_FLUSH_PATH);
+ bb_perror_msg("cannot open '%s'", fn);
return -1;
}
- len = strlen (buffer);
-
- if ((write (flush_fd, (void *)buffer, len)) < len) {
- fprintf(stderr, "Cannot flush routing cache\n");
+ if (write(flush_fd, "-1", 2) < 2) {
+ bb_perror_msg("cannot flush routing cache");
return -1;
}
close(flush_fd);
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h
index ebf2af1..556541f 100644
--- a/networking/libiproute/utils.h
+++ b/networking/libiproute/utils.h
@@ -14,7 +14,8 @@ extern int show_details;
extern int show_raw;
extern int resolve_hosts;
extern int oneline;
-extern char * _SL_;
+//FIXME! Appears in two .h files!
+extern const char * _SL_;
#ifndef IPPROTO_ESP
#define IPPROTO_ESP 50
diff --git a/networking/ping.c b/networking/ping.c
index 52e4886..53aabb6 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -369,7 +369,7 @@ static void sendping6(int junk ATTRIBUTE_UNUSED)
}
#endif
-static char *icmp_type_name(int id)
+static const char *icmp_type_name(int id)
{
switch (id) {
case ICMP_ECHOREPLY: return "Echo Reply";
@@ -400,7 +400,7 @@ static char *icmp_type_name(int id)
#ifndef MLD_LISTENER_REDUCTION
# define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION
#endif
-static char *icmp6_type_name(int id)
+static const char *icmp6_type_name(int id)
{
switch (id) {
case ICMP6_DST_UNREACH: return "Destination Unreachable";
@@ -761,7 +761,7 @@ int ping_main(int argc, char **argv)
#if ENABLE_PING6
int ping6_main(int argc, char **argv)
{
- argv[0] = "-6";
+ argv[0] = (char*)"-6";
return ping_main(argc + 1, argv - 1);
}
#endif
diff --git a/networking/zcip.c b/networking/zcip.c
index 5d57c42..b568706 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -130,10 +130,10 @@ static void arp(int fd, struct sockaddr *saddr, int op,
/**
* Run a script.
*/
-static int run(char *script, char *arg, char *intf, struct in_addr *ip)
+static int run(const char *script, const char *arg, const char *intf, struct in_addr *ip)
{
int pid, status;
- char *why;
+ const char *why;
if(1) { //always true: if (script != NULL)
VDBG("%s run %s %s\n", intf, script, arg);
@@ -207,7 +207,7 @@ static int state = PROBE;
int zcip_main(int argc, char *argv[])
{
struct ether_addr eth_addr;
- char *why;
+ const char *why;
int fd;
// parse commandline: prog [options] ifname script