aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c6
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 @@
#include <setjmp.h>
#include <fnmatch.h>
#include <sys/times.h>
+#include <sys/utsname.h> /* for setting $HOSTNAME */
#include "busybox.h" /* for applet_names */
#include "unicode.h"
@@ -13018,6 +13019,11 @@ init(void)
#if ENABLE_ASH_BASH_COMPAT
p = lookupvar("SHLVL");
setvar("SHLVL", utoa((p ? atoi(p) : 0) + 1), VEXPORT);
+ if (!lookupvar("HOSTNAME")) {
+ struct utsname uts;
+ uname(&uts);
+ setvar2("HOSTNAME", uts.nodename);
+ }
#endif
p = lookupvar("PWD");
if (p) {