summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko2007-06-12 08:52:02 +0000
committerDenis Vlasenko2007-06-12 08:52:02 +0000
commit15611bb95815de14bcb35f66bd10089a322ea30b (patch)
tree818f4e4a208cc04e37f2ea12fd4bda4eae30dd4c /libbb
parent16d58d75ee11f3b50550fbef7da12a4adbab66d4 (diff)
downloadbusybox-15611bb95815de14bcb35f66bd10089a322ea30b.zip
busybox-15611bb95815de14bcb35f66bd10089a322ea30b.tar.gz
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
Diffstat (limited to 'libbb')
-rw-r--r--libbb/messages.c4
-rw-r--r--libbb/setup_environment.c7
2 files changed, 5 insertions, 6 deletions
diff --git a/libbb/messages.c b/libbb/messages.c
index 16aaea5..9f62b9b 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 18d5a06..a98b9a5 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,