summaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-29 23:43:18 +0000
committerDenis Vlasenko2007-01-29 23:43:18 +0000
commit89ef65f02463b27313ff0eba806aa6e4aec10716 (patch)
tree70eab3e72843b1418ef3d88437c1f1a19169bda8 /miscutils
parentab2aea44479fd6f519bccd651a37f30e792b7593 (diff)
downloadbusybox-89ef65f02463b27313ff0eba806aa6e4aec10716.zip
busybox-89ef65f02463b27313ff0eba806aa6e4aec10716.tar.gz
preparatory patch for -Wwrite-strings #5
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/devfsd.c41
-rw-r--r--miscutils/mt.c2
-rw-r--r--miscutils/nmeter.c4
3 files changed, 23 insertions, 24 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