diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-30 05:05:31 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-30 05:05:31 +0000 |
commit | 76ddc2e3e4837d0557fb6626394f87648e5f8c3b (patch) | |
tree | f545fe36c1ebc20c743ab28bc0df2b0f1d28b59d /shell | |
parent | d6e8f9450cf055f0abfa424c5aa9e5a7c30d6593 (diff) | |
download | busybox-w32-76ddc2e3e4837d0557fb6626394f87648e5f8c3b.tar.gz busybox-w32-76ddc2e3e4837d0557fb6626394f87648e5f8c3b.tar.bz2 busybox-w32-76ddc2e3e4837d0557fb6626394f87648e5f8c3b.zip |
libbb: add bb_unsetenv (taken from hush).
udhcpc: stop filtering environment passed to the script.
crond: fix uncovered potential bug (failing unsetenv)
mdev: fix uncovered potential bug (failing unsetenv)
tcp, udpsvd: fix uncovered potential bug (failing unsetenv)
function old new delta
safe_setenv - 58 +58
bb_unsetenv - 55 +55
builtin_unset 139 138 -1
tcpudpsvd_main 1843 1830 -13
free_strings_and_unsetenv 87 53 -34
udhcp_run_script 1186 1133 -53
safe_setenv4 62 - -62
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/4 up/down: 113/-163) Total: -50 bytes
Diffstat (limited to 'shell')
-rw-r--r-- | shell/hush.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/shell/hush.c b/shell/hush.c index eafcbb4c9..3b87855b6 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -730,16 +730,8 @@ static void free_strings_and_unsetenv(char **strings, int unset) | |||
730 | v = strings; | 730 | v = strings; |
731 | while (*v) { | 731 | while (*v) { |
732 | if (unset) { | 732 | if (unset) { |
733 | char *copy; | 733 | debug_printf_env("unsetenv '%s'\n", *v); |
734 | /* *strchrnul(*v, '=') = '\0'; -- BAD | 734 | bb_unsetenv(*v); |
735 | * In case *v was putenv'ed, we can't | ||
736 | * unsetenv(*v) after taking out '=': | ||
737 | * it won't work, env is modified by taking out! | ||
738 | * horror :( */ | ||
739 | copy = xstrndup(*v, strchrnul(*v, '=') - *v); | ||
740 | debug_printf_env("unsetenv '%s'\n", copy); | ||
741 | unsetenv(copy); | ||
742 | free(copy); | ||
743 | } | 735 | } |
744 | free(*v++); | 736 | free(*v++); |
745 | } | 737 | } |
@@ -2937,7 +2929,7 @@ static void unset_local_var(const char *name) | |||
2937 | * is ro, and we cannot reach this code on the 1st pass */ | 2929 | * is ro, and we cannot reach this code on the 1st pass */ |
2938 | prev->next = cur->next; | 2930 | prev->next = cur->next; |
2939 | debug_printf_env("%s: unsetenv '%s'\n", __func__, cur->varstr); | 2931 | debug_printf_env("%s: unsetenv '%s'\n", __func__, cur->varstr); |
2940 | unsetenv(cur->varstr); | 2932 | bb_unsetenv(cur->varstr); |
2941 | if (!cur->max_len) | 2933 | if (!cur->max_len) |
2942 | free(cur->varstr); | 2934 | free(cur->varstr); |
2943 | free(cur); | 2935 | free(cur); |