diff options
author | Ron Yorston <rmy@pobox.com> | 2018-12-14 15:12:52 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-12-14 17:41:23 +0000 |
commit | 575581082befff0e049ef67fa36bbdd2ca737e29 (patch) | |
tree | 047f75d89b1c88838bd95e1335b51a62ee5ed615 /libbb | |
parent | 858091c25687727c335880dca459fe5b24259009 (diff) | |
download | busybox-w32-575581082befff0e049ef67fa36bbdd2ca737e29.tar.gz busybox-w32-575581082befff0e049ef67fa36bbdd2ca737e29.tar.bz2 busybox-w32-575581082befff0e049ef67fa36bbdd2ca737e29.zip |
ash: move code from setup_environment()
ash calls setup_environment() but only uses a small amount of its
functionality. Moving the code into ash itself means we don't
need to customise setup_environment() for WIN32 and can remove
it from the build.
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/Kbuild.src | 2 | ||||
-rw-r--r-- | libbb/setup_environment.c | 11 |
2 files changed, 1 insertions, 12 deletions
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src index 9323a8968..43ededbea 100644 --- a/libbb/Kbuild.src +++ b/libbb/Kbuild.src | |||
@@ -66,7 +66,6 @@ lib-y += safe_poll.o | |||
66 | lib-y += safe_strncpy.o | 66 | lib-y += safe_strncpy.o |
67 | lib-y += safe_write.o | 67 | lib-y += safe_write.o |
68 | lib-y += securetty.o | 68 | lib-y += securetty.o |
69 | lib-y += setup_environment.o | ||
70 | lib-y += single_argv.o | 69 | lib-y += single_argv.o |
71 | lib-y += skip_whitespace.o | 70 | lib-y += skip_whitespace.o |
72 | lib-y += str_tolower.o | 71 | lib-y += str_tolower.o |
@@ -106,6 +105,7 @@ lib-$(CONFIG_PLATFORM_POSIX) += pidfile.o | |||
106 | lib-$(CONFIG_PLATFORM_POSIX) += print_flags.o | 105 | lib-$(CONFIG_PLATFORM_POSIX) += print_flags.o |
107 | lib-$(CONFIG_PLATFORM_POSIX) += progress.o | 106 | lib-$(CONFIG_PLATFORM_POSIX) += progress.o |
108 | lib-$(CONFIG_PLATFORM_POSIX) += read_key.o | 107 | lib-$(CONFIG_PLATFORM_POSIX) += read_key.o |
108 | lib-$(CONFIG_PLATFORM_POSIX) += setup_environment.o | ||
109 | lib-$(CONFIG_PLATFORM_POSIX) += signals.o | 109 | lib-$(CONFIG_PLATFORM_POSIX) += signals.o |
110 | lib-$(CONFIG_PLATFORM_POSIX) += simplify_path.o | 110 | lib-$(CONFIG_PLATFORM_POSIX) += simplify_path.o |
111 | lib-$(CONFIG_PLATFORM_POSIX) += speed_table.o | 111 | lib-$(CONFIG_PLATFORM_POSIX) += speed_table.o |
diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c index c583206f0..f8de44967 100644 --- a/libbb/setup_environment.c +++ b/libbb/setup_environment.c | |||
@@ -29,14 +29,6 @@ | |||
29 | */ | 29 | */ |
30 | #include "libbb.h" | 30 | #include "libbb.h" |
31 | 31 | ||
32 | #if ENABLE_PLATFORM_MINGW32 | ||
33 | static void xsetenv_if_unset(const char *key, const char *value) | ||
34 | { | ||
35 | if (!getenv(key)) | ||
36 | xsetenv(key, value); | ||
37 | } | ||
38 | #endif | ||
39 | |||
40 | void FAST_FUNC setup_environment(const char *shell, int flags, const struct passwd *pw) | 32 | void FAST_FUNC setup_environment(const char *shell, int flags, const struct passwd *pw) |
41 | { | 33 | { |
42 | if (!shell || !shell[0]) | 34 | if (!shell || !shell[0]) |
@@ -68,9 +60,6 @@ void FAST_FUNC setup_environment(const char *shell, int flags, const struct pass | |||
68 | //xsetenv("HOME", pw->pw_dir); | 60 | //xsetenv("HOME", pw->pw_dir); |
69 | //xsetenv("SHELL", shell); | 61 | //xsetenv("SHELL", shell); |
70 | } else if (flags & SETUP_ENV_CHANGEENV) { | 62 | } else if (flags & SETUP_ENV_CHANGEENV) { |
71 | #if ENABLE_PLATFORM_MINGW32 | ||
72 | #define xsetenv(k, v) xsetenv_if_unset(k, v) | ||
73 | #endif | ||
74 | /* Set HOME, SHELL, and if not becoming a super-user, | 63 | /* Set HOME, SHELL, and if not becoming a super-user, |
75 | * USER and LOGNAME. */ | 64 | * USER and LOGNAME. */ |
76 | if (pw->pw_uid) { | 65 | if (pw->pw_uid) { |