A few more string duplicates found & eliminated

# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 679693    2700   15632  698025   aa6a9 busybox_old
 679523    2700   15632  697855   aa5ff busybox_unstripped
This commit is contained in:
Denis Vlasenko 2007-06-12 08:52:02 +00:00
parent 16d58d75ee
commit 15611bb958
6 changed files with 18 additions and 20 deletions

View File

@ -714,7 +714,7 @@ static const char *describe_status(int status_num)
{ {
int status_want, status_state ; int status_want, status_state ;
if (status_hashtable[status_num] == NULL || status_hashtable[status_num]->status == 0) if (status_hashtable[status_num] == NULL || status_hashtable[status_num]->status == 0)
return "is not installed or flagged to be installed\n"; return "is not installed or flagged to be installed";
status_want = get_status(status_num, 1); status_want = get_status(status_num, 1);
status_state = get_status(status_num, 3); status_state = get_status(status_num, 3);

View File

@ -953,6 +953,10 @@ extern const char bb_path_motd_file[];
extern const char bb_path_wtmp_file[]; extern const char bb_path_wtmp_file[];
extern const char bb_dev_null[]; extern const char bb_dev_null[];
extern const char bb_busybox_exec_path[]; extern const char bb_busybox_exec_path[];
/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
* but I want to save a few bytes here */
extern const char bb_default_root_login_path[]; /* "/sbin:/usr/sbin:/bin:/usr/bin" */
#define bb_default_login_path (bb_default_root_login_path + sizeof("/sbin:/usr/sbin"))
extern const int const_int_0; extern const int const_int_0;
extern const int const_int_1; extern const int const_int_1;

View File

@ -40,6 +40,10 @@ const char bb_path_motd_file[] = "/etc/motd";
const char bb_dev_null[] = "/dev/null"; const char bb_dev_null[] = "/dev/null";
const char bb_busybox_exec_path[] = CONFIG_BUSYBOX_EXEC_PATH; const char bb_busybox_exec_path[] = CONFIG_BUSYBOX_EXEC_PATH;
const char bb_default_login_shell[] = LIBBB_DEFAULT_LOGIN_SHELL; const char bb_default_login_shell[] = LIBBB_DEFAULT_LOGIN_SHELL;
/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
* but I want to save a few bytes here. Check libbb.h before changing! */
const char bb_default_root_login_path[] = "/sbin:/usr/sbin:/bin:/usr/bin";
const int const_int_0; const int const_int_0;
const int const_int_1 = 1; const int const_int_1 = 1;

View File

@ -30,11 +30,6 @@
#include "libbb.h" #include "libbb.h"
/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
* but I want to save a few bytes here */
static const char DEFAULT_ROOT_LOGIN_PATH[] = "/sbin:/usr/sbin:/bin:/usr/bin";
#define DEFAULT_LOGIN_PATH (DEFAULT_ROOT_LOGIN_PATH + sizeof("/sbin:/usr/sbin"))
void setup_environment(const char *shell, int loginshell, int changeenv, const struct passwd *pw) void setup_environment(const char *shell, int loginshell, int changeenv, const struct passwd *pw)
{ {
if (loginshell) { if (loginshell) {
@ -61,7 +56,7 @@ void setup_environment(const char *shell, int loginshell, int changeenv, const s
xsetenv("SHELL", shell); xsetenv("SHELL", shell);
xsetenv("USER", pw->pw_name); xsetenv("USER", pw->pw_name);
xsetenv("LOGNAME", pw->pw_name); xsetenv("LOGNAME", pw->pw_name);
xsetenv("PATH", (pw->pw_uid ? DEFAULT_LOGIN_PATH : DEFAULT_ROOT_LOGIN_PATH)); xsetenv("PATH", (pw->pw_uid ? bb_default_login_path : bb_default_root_login_path));
} }
else if (changeenv) { else if (changeenv) {
/* Set HOME, SHELL, and if not becoming a super-user, /* Set HOME, SHELL, and if not becoming a super-user,

View File

@ -4112,18 +4112,13 @@ int insmod_main( int argc, char **argv)
} }
if (strncmp(uts_info.release, m_strversion, STRVERSIONLEN) != 0) { if (strncmp(uts_info.release, m_strversion, STRVERSIONLEN) != 0) {
if (flag_force_load) { bb_error_msg("%skernel-module version mismatch\n"
bb_error_msg("warning: kernel-module version mismatch\n" "\t%s was compiled for kernel version %s\n"
"\t%s was compiled for kernel version %s\n" "\twhile this kernel is version %s",
"\twhile this kernel is version %s", flag_force_load ? "warning: " : "",
m_filename, m_strversion, uts_info.release); m_filename, m_strversion, uts_info.release);
} else { if (!flag_force_load)
bb_error_msg("kernel-module version mismatch\n"
"\t%s was compiled for kernel version %s\n"
"\twhile this kernel is version %s.",
m_filename, m_strversion, uts_info.release);
goto out; goto out;
}
} }
} }
k_crcs = 0; k_crcs = 0;

View File

@ -5213,9 +5213,9 @@ int msh_main(int argc, char **argv)
if (path->value == null) { if (path->value == null) {
/* Can be merged with same string elsewhere in bbox */ /* Can be merged with same string elsewhere in bbox */
if (geteuid() == 0) if (geteuid() == 0)
setval(path, "/sbin:/usr/sbin:/bin:/usr/bin"); setval(path, bb_default_root_login_path);
else else
setval(path, "/sbin:/usr/sbin:/bin:/usr/bin" + sizeof("/sbin:/usr/sbin")); setval(path, bb_default_login_path);
} }
export(path); export(path);