OSDN Git Service

A few more string duplicates found & eliminated
authorDenis Vlasenko <vda.linux@googlemail.com>
Tue, 12 Jun 2007 08:52:02 +0000 (08:52 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Tue, 12 Jun 2007 08:52:02 +0000 (08:52 -0000)
# 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

archival/dpkg.c
include/libbb.h
libbb/messages.c
libbb/setup_environment.c
modutils/insmod.c
shell/msh.c

index 0ca2704..c40a932 100644 (file)
@@ -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);
index a32a742..d42ce5f 100644 (file)
@@ -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;
index 16aaea5..9f62b9b 100644 (file)
@@ -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;
index 18d5a06..a98b9a5 100644 (file)
 
 #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,
index c84e2b9..a81ca7f 100644 (file)
@@ -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;
index aab805f..2ee5256 100644 (file)
@@ -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);