From 06c0a71d2315756db874e98bc4f760ca3283b6a6 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 29 Jan 2007 22:51:44 +0000 Subject: preparatory patch for -Wwrite-strings #3 --- loginutils/adduser.c | 4 ++-- loginutils/getty.c | 16 ++++++++-------- loginutils/passwd.c | 4 ++-- loginutils/su.c | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'loginutils') diff --git a/loginutils/adduser.c b/loginutils/adduser.c index ea0b89a9b..5a48e9cbb 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 f2c2b4afb..8f81cafcc 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c @@ -33,7 +33,7 @@ #include #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 5c822b190..ab20f2807 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 e1c1591aa..9a134dd88 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; -- cgit v1.2.3