From: Denis Vlasenko Date: Tue, 12 Jun 2007 08:52:02 +0000 (-0000) Subject: A few more string duplicates found & eliminated X-Git-Tag: 1_7_0~249 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=15611bb95815de14bcb35f66bd10089a322ea30b;p=oweals%2Fbusybox.git 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 --- diff --git a/archival/dpkg.c b/archival/dpkg.c index 0ca2704a1..c40a932ec 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -714,7 +714,7 @@ static const char *describe_status(int status_num) { int status_want, status_state ; 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_state = get_status(status_num, 3); diff --git a/include/libbb.h b/include/libbb.h index a32a74253..d42ce5f39 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -953,6 +953,10 @@ extern const char bb_path_motd_file[]; extern const char bb_path_wtmp_file[]; extern const char bb_dev_null[]; 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_1; diff --git a/libbb/messages.c b/libbb/messages.c index 16aaea553..9f62b9b0d 100644 --- a/libbb/messages.c +++ b/libbb/messages.c @@ -40,6 +40,10 @@ const char bb_path_motd_file[] = "/etc/motd"; const char bb_dev_null[] = "/dev/null"; const char bb_busybox_exec_path[] = CONFIG_BUSYBOX_EXEC_PATH; 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_1 = 1; diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c index 18d5a0610..a98b9a5bd 100644 --- a/libbb/setup_environment.c +++ b/libbb/setup_environment.c @@ -30,11 +30,6 @@ #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) { if (loginshell) { @@ -61,7 +56,7 @@ void setup_environment(const char *shell, int loginshell, int changeenv, const s xsetenv("SHELL", shell); xsetenv("USER", 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) { /* Set HOME, SHELL, and if not becoming a super-user, diff --git a/modutils/insmod.c b/modutils/insmod.c index c84e2b96c..a81ca7fba 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -4112,18 +4112,13 @@ int insmod_main( int argc, char **argv) } if (strncmp(uts_info.release, m_strversion, STRVERSIONLEN) != 0) { - if (flag_force_load) { - bb_error_msg("warning: 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); - } else { - 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); + bb_error_msg("%skernel-module version mismatch\n" + "\t%s was compiled for kernel version %s\n" + "\twhile this kernel is version %s", + flag_force_load ? "warning: " : "", + m_filename, m_strversion, uts_info.release); + if (!flag_force_load) goto out; - } } } k_crcs = 0; diff --git a/shell/msh.c b/shell/msh.c index aab805ff5..2ee5256f7 100644 --- a/shell/msh.c +++ b/shell/msh.c @@ -5213,9 +5213,9 @@ int msh_main(int argc, char **argv) if (path->value == null) { /* Can be merged with same string elsewhere in bbox */ if (geteuid() == 0) - setval(path, "/sbin:/usr/sbin:/bin:/usr/bin"); + setval(path, bb_default_root_login_path); else - setval(path, "/sbin:/usr/sbin:/bin:/usr/bin" + sizeof("/sbin:/usr/sbin")); + setval(path, bb_default_login_path); } export(path);