diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2014-04-15 11:43:29 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-04-15 11:43:29 +0200 |
commit | 3fa97af7ccc75264fb237f279f253eddf0ba4da1 (patch) | |
tree | d9897c308b55ecaf08b3f6da191b4a1d03e387a8 /shell/ash.c | |
parent | ad16741ccd8a8587644d88fb8fdfc41ada1928a6 (diff) | |
download | busybox-w32-3fa97af7ccc75264fb237f279f253eddf0ba4da1.tar.gz busybox-w32-3fa97af7ccc75264fb237f279f253eddf0ba4da1.tar.bz2 busybox-w32-3fa97af7ccc75264fb237f279f253eddf0ba4da1.zip |
ash,hush: set $HOSTNAME is bash compat. Closes 7028
function old new delta
hush_main 1056 1128 +72
ash_main 1442 1487 +45
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index 7a097c814..cabeb40c5 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <setjmp.h> | 41 | #include <setjmp.h> |
42 | #include <fnmatch.h> | 42 | #include <fnmatch.h> |
43 | #include <sys/times.h> | 43 | #include <sys/times.h> |
44 | #include <sys/utsname.h> /* for setting $HOSTNAME */ | ||
44 | 45 | ||
45 | #include "busybox.h" /* for applet_names */ | 46 | #include "busybox.h" /* for applet_names */ |
46 | #include "unicode.h" | 47 | #include "unicode.h" |
@@ -13018,6 +13019,11 @@ init(void) | |||
13018 | #if ENABLE_ASH_BASH_COMPAT | 13019 | #if ENABLE_ASH_BASH_COMPAT |
13019 | p = lookupvar("SHLVL"); | 13020 | p = lookupvar("SHLVL"); |
13020 | setvar("SHLVL", utoa((p ? atoi(p) : 0) + 1), VEXPORT); | 13021 | setvar("SHLVL", utoa((p ? atoi(p) : 0) + 1), VEXPORT); |
13022 | if (!lookupvar("HOSTNAME")) { | ||
13023 | struct utsname uts; | ||
13024 | uname(&uts); | ||
13025 | setvar2("HOSTNAME", uts.nodename); | ||
13026 | } | ||
13021 | #endif | 13027 | #endif |
13022 | p = lookupvar("PWD"); | 13028 | p = lookupvar("PWD"); |
13023 | if (p) { | 13029 | if (p) { |