mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 00:55:11 +00:00
preparatory patch for -Wwrite-strings #5
This commit is contained in:
parent
ab2aea4447
commit
89ef65f024
@ -242,7 +242,7 @@ static const char *expand_variable( char *, unsigned, unsigned *, const char *,
|
|||||||
const char *(*) (const char *, void *), void * );
|
const char *(*) (const char *, void *), void * );
|
||||||
static const char *get_variable_v2(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 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 */
|
/* busybox functions */
|
||||||
static void msg_logger(int pri, const char * fmt, ... )__attribute__ ((format (printf, 2, 3)));
|
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 volatile int caught_sighup = FALSE;
|
||||||
static struct initial_symlink_struct
|
static struct initial_symlink_struct
|
||||||
{
|
{
|
||||||
char *dest;
|
const char *dest;
|
||||||
char *name;
|
const char *name;
|
||||||
} initial_symlinks[] =
|
} initial_symlinks[] =
|
||||||
{
|
{
|
||||||
{"/proc/self/fd", "fd"},
|
{"/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() */
|
/* NB: The check for CONFIG_FILE is done in read_config_file() */
|
||||||
|
|
||||||
if ( print_version || (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev) )
|
if (print_version || (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev)) {
|
||||||
{
|
printf("%s v%s\nDaemon %s:\t%d\nKernel-side %s:\t%d\n",
|
||||||
printf( "%s v%s\nDaemon %s:\t%d\nKernel-side %s:\t%d\n",
|
|
||||||
applet_name,DEVFSD_VERSION,bb_msg_proto_rev,
|
applet_name,DEVFSD_VERSION,bb_msg_proto_rev,
|
||||||
DEVFSD_PROTOCOL_REVISION_DAEMON,bb_msg_proto_rev, proto_rev);
|
DEVFSD_PROTOCOL_REVISION_DAEMON,bb_msg_proto_rev, proto_rev);
|
||||||
if (DEVFSD_PROTOCOL_REVISION_DAEMON != 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) */
|
/* Tell kernel we are special (i.e. we get to see hidden entries) */
|
||||||
do_ioctl_and_die(fd, DEVFSDIOC_SET_EVENT_MASK, 0);
|
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;
|
new_action.sa_flags = 0;
|
||||||
|
|
||||||
/* Set up SIGHUP and SIGUSR1 handlers */
|
/* Set up SIGHUP and SIGUSR1 handlers */
|
||||||
new_action.sa_handler = signal_handler;
|
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");
|
devfsd_error_msg_and_die( "sigaction");
|
||||||
|
|
||||||
printf("%s v%s started for %s\n",applet_name, DEVFSD_VERSION, mount_point);
|
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 */
|
/* Set umask so that mknod(2), open(2) and mkdir(2) have complete control over permissions */
|
||||||
umask (0);
|
umask(0);
|
||||||
read_config_file (CONFIG_FILE, FALSE, &event_mask);
|
read_config_file((char*)CONFIG_FILE, FALSE, &event_mask);
|
||||||
/* Do the scan before forking, so that boot scripts see the finished product */
|
/* Do the scan before forking, so that boot scripts see the finished product */
|
||||||
dir_operation(SERVICE,mount_point,0,NULL);
|
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);
|
do_scan = do_servicing (fd, event_mask);
|
||||||
|
|
||||||
free_config ();
|
free_config ();
|
||||||
read_config_file (CONFIG_FILE, FALSE, &event_mask);
|
read_config_file ((char*)CONFIG_FILE, FALSE, &event_mask);
|
||||||
if (do_scan)
|
if (do_scan)
|
||||||
dir_operation(SERVICE,mount_point,0,NULL);
|
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;
|
struct stat statbuf;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[STRING_LENGTH];
|
char buf[STRING_LENGTH];
|
||||||
char *line=NULL;
|
char *line = NULL;
|
||||||
|
|
||||||
debug_msg_logger(LOG_INFO, "%s: %s", __FUNCTION__, path);
|
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 p[MAX_ARGS][STRING_LENGTH];
|
||||||
char when[STRING_LENGTH], what[STRING_LENGTH];
|
char when[STRING_LENGTH], what[STRING_LENGTH];
|
||||||
char name[STRING_LENGTH];
|
char name[STRING_LENGTH];
|
||||||
char * msg="";
|
const char *msg = "";
|
||||||
char *ptr;
|
char *ptr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -876,10 +875,10 @@ static void action_modload (const struct devfsd_notify_struct *info,
|
|||||||
char *argv[6];
|
char *argv[6];
|
||||||
char device[STRING_LENGTH];
|
char device[STRING_LENGTH];
|
||||||
|
|
||||||
argv[0] = MODPROBE;
|
argv[0] = (char*)MODPROBE;
|
||||||
argv[1] = MODPROBE_SWITCH_1; /* "-k" */
|
argv[1] = (char*)MODPROBE_SWITCH_1; /* "-k" */
|
||||||
argv[2] = MODPROBE_SWITCH_2; /* "-C" */
|
argv[2] = (char*)MODPROBE_SWITCH_2; /* "-C" */
|
||||||
argv[3] = CONFIG_MODULES_DEVFS;
|
argv[3] = (char*)CONFIG_MODULES_DEVFS;
|
||||||
argv[4] = device;
|
argv[4] = device;
|
||||||
argv[5] = NULL;
|
argv[5] = NULL;
|
||||||
|
|
||||||
@ -1221,7 +1220,7 @@ static int get_uid_gid (int flag, const char *string)
|
|||||||
{
|
{
|
||||||
struct passwd *pw_ent;
|
struct passwd *pw_ent;
|
||||||
struct group *grp_ent;
|
struct group *grp_ent;
|
||||||
static char *msg;
|
static const char *msg;
|
||||||
|
|
||||||
if (ENABLE_DEVFSD_VERBOSE)
|
if (ENABLE_DEVFSD_VERBOSE)
|
||||||
msg="user";
|
msg="user";
|
||||||
@ -1532,8 +1531,8 @@ static void expand_regexp (char *output, size_t outsize, const char *input,
|
|||||||
|
|
||||||
struct translate_struct
|
struct translate_struct
|
||||||
{
|
{
|
||||||
char *match; /* The string to match to (up to length) */
|
const char *match; /* The string to match to (up to length) */
|
||||||
char *format; /* Format of output, "%s" takes data past match string,
|
const char *format; /* Format of output, "%s" takes data past match string,
|
||||||
NULL is effectively "%s" (just more efficient) */
|
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,
|
static char *write_old_sd_name (char *buffer,
|
||||||
unsigned int major, unsigned int minor,
|
unsigned int major, unsigned int minor,
|
||||||
char *part)
|
const char *part)
|
||||||
/* [SUMMARY] Write the old SCSI disc name to a buffer.
|
/* [SUMMARY] Write the old SCSI disc name to a buffer.
|
||||||
<buffer> The buffer to write to.
|
<buffer> The buffer to write to.
|
||||||
<major> The major number for the device.
|
<major> The major number for the device.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <sys/mtio.h>
|
#include <sys/mtio.h>
|
||||||
|
|
||||||
struct mt_opcodes {
|
struct mt_opcodes {
|
||||||
char *name;
|
const char *name;
|
||||||
short value;
|
short value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ typedef unsigned long long ullong;
|
|||||||
enum { proc_file_size = 4096 };
|
enum { proc_file_size = 4096 };
|
||||||
|
|
||||||
typedef struct proc_file {
|
typedef struct proc_file {
|
||||||
char *name;
|
const char *name;
|
||||||
int gen;
|
int gen;
|
||||||
char *file;
|
char *file;
|
||||||
} proc_file;
|
} proc_file;
|
||||||
@ -38,7 +38,7 @@ static struct timeval tv;
|
|||||||
static int delta = 1000000;
|
static int delta = 1000000;
|
||||||
static int deltanz = 1000000;
|
static int deltanz = 1000000;
|
||||||
static int need_seconds = 0;
|
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
|
// We depend on this being a char[], not char* - we take sizeof() of it
|
||||||
#define outbuf bb_common_bufsiz1
|
#define outbuf bb_common_bufsiz1
|
||||||
|
@ -36,22 +36,19 @@ struct interface_defn_t;
|
|||||||
|
|
||||||
typedef int execfn(char *command);
|
typedef int execfn(char *command);
|
||||||
|
|
||||||
struct method_t
|
struct method_t {
|
||||||
{
|
const char *name;
|
||||||
char *name;
|
|
||||||
int (*up)(struct interface_defn_t *ifd, execfn *e);
|
int (*up)(struct interface_defn_t *ifd, execfn *e);
|
||||||
int (*down)(struct interface_defn_t *ifd, execfn *e);
|
int (*down)(struct interface_defn_t *ifd, execfn *e);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct address_family_t
|
struct address_family_t {
|
||||||
{
|
const char *name;
|
||||||
char *name;
|
|
||||||
int n_methods;
|
int n_methods;
|
||||||
const struct method_t *method;
|
const struct method_t *method;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mapping_defn_t
|
struct mapping_defn_t {
|
||||||
{
|
|
||||||
struct mapping_defn_t *next;
|
struct mapping_defn_t *next;
|
||||||
|
|
||||||
int max_matches;
|
int max_matches;
|
||||||
@ -65,14 +62,12 @@ struct mapping_defn_t
|
|||||||
char **mapping;
|
char **mapping;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct variable_t
|
struct variable_t {
|
||||||
{
|
|
||||||
char *name;
|
char *name;
|
||||||
char *value;
|
char *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct interface_defn_t
|
struct interface_defn_t {
|
||||||
{
|
|
||||||
const struct address_family_t *address_family;
|
const struct address_family_t *address_family;
|
||||||
const struct method_t *method;
|
const struct method_t *method;
|
||||||
|
|
||||||
@ -82,8 +77,7 @@ struct interface_defn_t
|
|||||||
struct variable_t *option;
|
struct variable_t *option;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct interfaces_file_t
|
struct interfaces_file_t {
|
||||||
{
|
|
||||||
llist_t *autointerfaces;
|
llist_t *autointerfaces;
|
||||||
llist_t *ifaces;
|
llist_t *ifaces;
|
||||||
struct mapping_defn_t *mappings;
|
struct mapping_defn_t *mappings;
|
||||||
@ -105,7 +99,7 @@ enum {
|
|||||||
|
|
||||||
static char **my_environ;
|
static char **my_environ;
|
||||||
|
|
||||||
static char *startup_PATH;
|
static const char *startup_PATH;
|
||||||
|
|
||||||
#if ENABLE_FEATURE_IFUPDOWN_IPV4 || ENABLE_FEATURE_IFUPDOWN_IPV6
|
#if ENABLE_FEATURE_IFUPDOWN_IPV4 || ENABLE_FEATURE_IFUPDOWN_IPV6
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int preferred_family;
|
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 void ip_parse_common_args(int *argcp, char ***argvp);
|
||||||
extern int print_neigh(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);
|
extern int print_neigh(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
int preferred_family = AF_UNSPEC;
|
int preferred_family = AF_UNSPEC;
|
||||||
int oneline = 0;
|
int oneline = 0;
|
||||||
char * _SL_ = NULL;
|
const char * _SL_ = NULL;
|
||||||
|
|
||||||
void ip_parse_common_args(int *argcp, char ***argvp)
|
void ip_parse_common_args(int *argcp, char ***argvp)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
/* take from linux/sockios.h */
|
/* take from linux/sockios.h */
|
||||||
#define SIOCSIFNAME 0x8923 /* set interface name */
|
#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);
|
bb_error_msg("error: argument of \"%s\" must be \"on\" or \"off\"", msg);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -469,21 +469,15 @@ static int rtnl_rtcache_request(struct rtnl_handle *rth, int family)
|
|||||||
|
|
||||||
static int iproute_flush_cache(void)
|
static int iproute_flush_cache(void)
|
||||||
{
|
{
|
||||||
#define ROUTE_FLUSH_PATH "/proc/sys/net/ipv4/route/flush"
|
static const char fn[] = "/proc/sys/net/ipv4/route/flush";
|
||||||
|
int flush_fd = open(fn, O_WRONLY);
|
||||||
int len;
|
|
||||||
int flush_fd = open (ROUTE_FLUSH_PATH, O_WRONLY);
|
|
||||||
char *buffer = "-1";
|
|
||||||
|
|
||||||
if (flush_fd < 0) {
|
if (flush_fd < 0) {
|
||||||
fprintf(stderr, "Cannot open \"%s\"\n", ROUTE_FLUSH_PATH);
|
bb_perror_msg("cannot open '%s'", fn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strlen (buffer);
|
if (write(flush_fd, "-1", 2) < 2) {
|
||||||
|
bb_perror_msg("cannot flush routing cache");
|
||||||
if ((write (flush_fd, (void *)buffer, len)) < len) {
|
|
||||||
fprintf(stderr, "Cannot flush routing cache\n");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
close(flush_fd);
|
close(flush_fd);
|
||||||
|
@ -14,7 +14,8 @@ extern int show_details;
|
|||||||
extern int show_raw;
|
extern int show_raw;
|
||||||
extern int resolve_hosts;
|
extern int resolve_hosts;
|
||||||
extern int oneline;
|
extern int oneline;
|
||||||
extern char * _SL_;
|
//FIXME! Appears in two .h files!
|
||||||
|
extern const char * _SL_;
|
||||||
|
|
||||||
#ifndef IPPROTO_ESP
|
#ifndef IPPROTO_ESP
|
||||||
#define IPPROTO_ESP 50
|
#define IPPROTO_ESP 50
|
||||||
|
@ -369,7 +369,7 @@ static void sendping6(int junk ATTRIBUTE_UNUSED)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *icmp_type_name(int id)
|
static const char *icmp_type_name(int id)
|
||||||
{
|
{
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case ICMP_ECHOREPLY: return "Echo Reply";
|
case ICMP_ECHOREPLY: return "Echo Reply";
|
||||||
@ -400,7 +400,7 @@ static char *icmp_type_name(int id)
|
|||||||
#ifndef MLD_LISTENER_REDUCTION
|
#ifndef MLD_LISTENER_REDUCTION
|
||||||
# define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION
|
# define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION
|
||||||
#endif
|
#endif
|
||||||
static char *icmp6_type_name(int id)
|
static const char *icmp6_type_name(int id)
|
||||||
{
|
{
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case ICMP6_DST_UNREACH: return "Destination Unreachable";
|
case ICMP6_DST_UNREACH: return "Destination Unreachable";
|
||||||
@ -761,7 +761,7 @@ int ping_main(int argc, char **argv)
|
|||||||
#if ENABLE_PING6
|
#if ENABLE_PING6
|
||||||
int ping6_main(int argc, char **argv)
|
int ping6_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
argv[0] = "-6";
|
argv[0] = (char*)"-6";
|
||||||
return ping_main(argc + 1, argv - 1);
|
return ping_main(argc + 1, argv - 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -130,10 +130,10 @@ static void arp(int fd, struct sockaddr *saddr, int op,
|
|||||||
/**
|
/**
|
||||||
* Run a script.
|
* 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;
|
int pid, status;
|
||||||
char *why;
|
const char *why;
|
||||||
|
|
||||||
if(1) { //always true: if (script != NULL)
|
if(1) { //always true: if (script != NULL)
|
||||||
VDBG("%s run %s %s\n", intf, script, arg);
|
VDBG("%s run %s %s\n", intf, script, arg);
|
||||||
@ -207,7 +207,7 @@ static int state = PROBE;
|
|||||||
int zcip_main(int argc, char *argv[])
|
int zcip_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct ether_addr eth_addr;
|
struct ether_addr eth_addr;
|
||||||
char *why;
|
const char *why;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
// parse commandline: prog [options] ifname script
|
// parse commandline: prog [options] ifname script
|
||||||
|
Loading…
Reference in New Issue
Block a user