summaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-29 22:51:44 +0000
committerDenis Vlasenko2007-01-29 22:51:44 +0000
commit06c0a71d2315756db874e98bc4f760ca3283b6a6 (patch)
treedf385c84041f3fd8328e7a50caef4495ef2734a8 /loginutils
parentb6aae0f38194cd39960a898606ee65d4be93a895 (diff)
downloadbusybox-06c0a71d2315756db874e98bc4f760ca3283b6a6.zip
busybox-06c0a71d2315756db874e98bc4f760ca3283b6a6.tar.gz
preparatory patch for -Wwrite-strings #3
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/adduser.c4
-rw-r--r--loginutils/getty.c16
-rw-r--r--loginutils/passwd.c4
-rw-r--r--loginutils/su.c6
4 files changed, 15 insertions, 15 deletions
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index ea0b89a..5a48e9c 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -169,7 +169,7 @@ int adduser_main(int argc, char **argv)
bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
}
- pw.pw_gecos = "Linux User,,,";
+ pw.pw_gecos = (char *)"Linux User,,,";
pw.pw_shell = (char *)DEFAULT_SHELL;
pw.pw_dir = NULL;
@@ -185,7 +185,7 @@ int adduser_main(int argc, char **argv)
/* create a passwd struct */
pw.pw_name = argv[optind];
- pw.pw_passwd = "x";
+ pw.pw_passwd = (char *)"x";
pw.pw_uid = 0;
pw.pw_gid = usegroup ? xgroup2gid(usegroup) : 0; /* exits on failure */
diff --git a/loginutils/getty.c b/loginutils/getty.c
index f2c2b4a..8f81caf 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -33,7 +33,7 @@
#include <time.h>
#if ENABLE_FEATURE_WTMP
extern void updwtmp(const char *filename, const struct utmp *ut);
-static void update_utmp(char *line);
+static void update_utmp(const char *line);
#endif
#endif /* LOGIN_PROCESS */
@@ -85,10 +85,10 @@ static void update_utmp(char *line);
struct options {
int flags; /* toggle switches, see below */
unsigned timeout; /* time-out period */
- char *login; /* login program */
- char *tty; /* name of tty */
- char *initstring; /* modem init string */
- char *issue; /* alternative issue file */
+ const char *login; /* login program */
+ const char *tty; /* name of tty */
+ const char *initstring; /* modem init string */
+ const char *issue; /* alternative issue file */
int numspeed; /* number of baud rates to try */
int speeds[MAX_SPEED]; /* baud rates to be tried */
};
@@ -187,7 +187,7 @@ static void parse_args(int argc, char **argv, struct options *op)
const char *p = op->initstring;
char *q;
- q = op->initstring = xstrdup(op->initstring);
+ op->initstring = q = xstrdup(op->initstring);
/* copy optarg into op->initstring decoding \ddd
octal codes into chars */
while (*p) {
@@ -233,7 +233,7 @@ static void xdup2(int srcfd, int dstfd, const char *tty)
}
/* open_tty - set up tty as standard { input, output, error } */
-static void open_tty(char *tty, struct termios *tp, int local)
+static void open_tty(const char *tty, struct termios *tp, int local)
{
int chdir_to_root = 0;
@@ -655,7 +655,7 @@ static void termios_final(struct options *op, struct termios *tp, struct chardat
#ifdef SYSV_STYLE
#if ENABLE_FEATURE_UTMP
/* update_utmp - update our utmp entry */
-static void update_utmp(char *line)
+static void update_utmp(const char *line)
{
struct utmp ut;
struct utmp *utp;
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index 5c822b1..ab20f28 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -53,7 +53,7 @@ static void crypt_make_salt(char *p, int cnt)
static char* new_password(const struct passwd *pw, uid_t myuid, int algo)
{
char salt[sizeof("$N$XXXXXXXX")]; /* "$N$XXXXXXXX" or "XX" */
- char *orig = "";
+ char *orig = (char*)"";
char *newp = NULL;
char *cipher = NULL;
char *cp = NULL;
@@ -241,7 +241,7 @@ int passwd_main(int argc, char **argv)
/*STATE_ALGO_des = 0x20, not needed yet */
};
unsigned opt;
- char *opt_a = "";
+ const char *opt_a = "";
const char *filename;
char *myname;
char *name;
diff --git a/loginutils/su.c b/loginutils/su.c
index e1c1591..9a134dd 100644
--- a/loginutils/su.c
+++ b/loginutils/su.c
@@ -14,9 +14,9 @@
int su_main(int argc, char **argv)
{
unsigned flags;
- char *opt_shell = 0;
- char *opt_command = 0;
- char *opt_username = "root";
+ char *opt_shell = NULL;
+ char *opt_command = NULL;
+ const char *opt_username = "root";
struct passwd *pw;
uid_t cur_uid = getuid();
const char *tty;