svn commit: trunk/busybox: archival include libbb modutils shell

vda at busybox.net vda at busybox.net
Tue Jun 12 08:52:04 UTC 2007


Author: vda
Date: 2007-06-12 01:52:02 -0700 (Tue, 12 Jun 2007)
New Revision: 18800

Log:
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



Modified:
   trunk/busybox/archival/dpkg.c
   trunk/busybox/include/libbb.h
   trunk/busybox/libbb/messages.c
   trunk/busybox/libbb/setup_environment.c
   trunk/busybox/modutils/insmod.c
   trunk/busybox/shell/msh.c


Changeset:
Modified: trunk/busybox/archival/dpkg.c
===================================================================
--- trunk/busybox/archival/dpkg.c	2007-06-12 08:13:34 UTC (rev 18799)
+++ trunk/busybox/archival/dpkg.c	2007-06-12 08:52:02 UTC (rev 18800)
@@ -714,7 +714,7 @@
 {
 	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);

Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2007-06-12 08:13:34 UTC (rev 18799)
+++ trunk/busybox/include/libbb.h	2007-06-12 08:52:02 UTC (rev 18800)
@@ -953,6 +953,10 @@
 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;

Modified: trunk/busybox/libbb/messages.c
===================================================================
--- trunk/busybox/libbb/messages.c	2007-06-12 08:13:34 UTC (rev 18799)
+++ trunk/busybox/libbb/messages.c	2007-06-12 08:52:02 UTC (rev 18800)
@@ -40,7 +40,11 @@
 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;
 

Modified: trunk/busybox/libbb/setup_environment.c
===================================================================
--- trunk/busybox/libbb/setup_environment.c	2007-06-12 08:13:34 UTC (rev 18799)
+++ trunk/busybox/libbb/setup_environment.c	2007-06-12 08:52:02 UTC (rev 18800)
@@ -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 @@
 		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,

Modified: trunk/busybox/modutils/insmod.c
===================================================================
--- trunk/busybox/modutils/insmod.c	2007-06-12 08:13:34 UTC (rev 18799)
+++ trunk/busybox/modutils/insmod.c	2007-06-12 08:52:02 UTC (rev 18800)
@@ -4112,18 +4112,13 @@
 		}
 
 		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;

Modified: trunk/busybox/shell/msh.c
===================================================================
--- trunk/busybox/shell/msh.c	2007-06-12 08:13:34 UTC (rev 18799)
+++ trunk/busybox/shell/msh.c	2007-06-12 08:52:02 UTC (rev 18800)
@@ -5213,9 +5213,9 @@
 	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);
 




More information about the busybox-cvs mailing list