/* Force the TERM setting to vt102 for serial console --
* if TERM is set to linux (the default) */
if (s == NULL || strcmp(s, "linux") == 0)
- putenv("TERM=vt102");
+ putenv((char*)"TERM=vt102");
#if !ENABLE_SYSLOGD
log_console = console;
#endif
} else {
if (s == NULL)
- putenv("TERM=linux");
+ putenv((char*)"TERM=linux");
}
close(fd);
}
messageD(LOG, "console=%s", console);
}
-static void fixup_argv(int argc, char **argv, char *new_argv0)
+static void fixup_argv(int argc, char **argv, const char *new_argv0)
{
int len;
/* Fix up argv[0] to be certain we claim to be init */
len = strlen(argv[0]);
- memset(argv[0], 0, len);
- safe_strncpy(argv[0], new_argv0, len + 1);
+ strncpy(argv[0], new_argv0, len);
/* Wipe argv[1]-argv[N] so they don't clutter the ps listing */
len = 1;
{
int i;
pid_t pid;
- char *s, *tmpCmd, *cmd[INIT_BUFFS_SIZE], *cmdpath;
+ char *s, *tmpCmd, *cmdpath;
+ char *cmd[INIT_BUFFS_SIZE];
char buf[INIT_BUFFS_SIZE + 6]; /* INIT_BUFFS_SIZE+strlen("exec ")+1 */
sigset_t nmask, omask;
static const char press_enter[] =
#include CUSTOMIZED_BANNER
#endif
"\nPlease press Enter to activate this console. ";
- char *prog;
+ const char *prog;
/* Block sigchild while forking. */
sigemptyset(&nmask);
/* See if any special /bin/sh requiring characters are present */
if (strpbrk(a->command, "~`!$^&*()=|\\{}[];\"'<>?") != NULL) {
cmd[0] = (char *)DEFAULT_SHELL;
- cmd[1] = "-c";
+ cmd[1] = (char*)"-c";
cmd[2] = strcat(strcpy(buf, "exec "), a->command);
cmd[3] = NULL;
} else {
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;
/* 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 */
#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 */
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 */
};
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) {
}
/* 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;
#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;
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;
/*STATE_ALGO_des = 0x20, not needed yet */
};
unsigned opt;
- char *opt_a = "";
+ const char *opt_a = "";
const char *filename;
char *myname;
char *name;
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;
/*
* CHILD - change user and run editor
*/
- char *ptr;
- char visual[1024];
+ const char *ptr;
if (ChangeUser(user, 1) < 0)
exit(0);
if (ptr == NULL || strlen(ptr) > 256)
ptr = PATH_VI;
- snprintf(visual, sizeof(visual), "%s %s", ptr, file);
- execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", visual, NULL);
- perror("exec");
- exit(0);
+ ptr = xasprintf("%s %s", ptr, file);
+ execl(DEFAULT_SHELL, DEFAULT_SHELL, "-c", ptr, NULL);
+ bb_perror_msg_and_die("exec");
}
if (pid < 0) {
/*
static void delete_partition(int i);
static int get_partition(int warn, int max);
static void list_types(const struct systypes *sys);
-static unsigned read_int(unsigned low, unsigned dflt, unsigned high, unsigned base, char *mesg);
+static unsigned read_int(unsigned low, unsigned dflt, unsigned high, unsigned base, const char *mesg);
#endif
static const char *partition_type(unsigned char type);
static void fdisk_fatal(enum failure why) ATTRIBUTE_NORETURN;
* There is no default if DFLT is not between LOW and HIGH.
*/
static unsigned
-read_int(unsigned low, unsigned dflt, unsigned high, unsigned base, char *mesg)
+read_int(unsigned low, unsigned dflt, unsigned high, unsigned base, const char *mesg)
{
unsigned i;
int default_ok = 1;
}
static int
-edit_int(int def, char *mesg)
+edit_int(int def, const char *mesg)
{
mesg = xasprintf("%s (%d): ", mesg, def);
do {
} while (!isdigit(*line_ptr));
def = atoi(line_ptr);
ret:
- free(mesg);
+ free((char*)mesg);
return def;
}
static void
xbsd_write_bootstrap(void)
{
- char *bootdir = BSD_LINUX_BOOTDIR;
char path[MAXPATHLEN];
- char *dkbasename;
+ const char *bootdir = BSD_LINUX_BOOTDIR;
+ const char *dkbasename;
struct xbsd_disklabel dl;
char *d, *p, *e;
int sector;
(c == 'm') ? shmget(key, 0, 0) : semget(key, 0, 0));
if (id < 0) {
- char *errmsg;
- const char * const what = "key";
+ const char *errmsg;
+ const char *const what = "key";
error++;
switch (errno) {
semctl(id, 0, IPC_RMID, arg));
if (result) {
- char *errmsg;
- const char * const what = iskey ? "key" : "id";
+ const char *errmsg;
+ const char *const what = iskey ? "key" : "id";
error++;
switch (errno) {
* flags */
struct {
- char *name;
+ const char *name;
long flags;
} static mount_options[] = {
// MS_FLAGS set a bit. ~MS_FLAGS disable that bit. 0 flags are NOPs.
#define VECTOR_SIZE(v) (sizeof(v) / sizeof((v)[0]))
/* Append mount options to string */
-static void append_mount_options(char **oldopts, char *newopts)
+static void append_mount_options(char **oldopts, const char *newopts)
{
if (*oldopts && **oldopts) {
/* do not insert options which are already there */
fsname = 0;
if (!mp->mnt_type || !*mp->mnt_type) { /* bind mount */
mp->mnt_fsname = fsname = bb_simplify_path(mp->mnt_fsname);
- mp->mnt_type = "bind";
+ mp->mnt_type = (char*)"bind";
}
mp->mnt_freq = mp->mnt_passno = 0;
do_mount: /* perform actual mount */
- mp->mnt_type = "nfs";
+ mp->mnt_type = (char*)"nfs";
retval = mount_it_now(mp, vfsflags, (char*)&data);
goto ret;
// lock is required
vfsflags |= MS_MANDLOCK;
- mp->mnt_type = "cifs";
+ mp->mnt_type = (char*)"cifs";
rc = mount_it_now(mp, vfsflags, filteropts);
if (ENABLE_FEATURE_CLEAN_UP) free(mp->mnt_fsname);
goto report_error;