summaryrefslogtreecommitdiff
path: root/svr-chansession.c
diff options
context:
space:
mode:
authorfidomax <adobegitler@gmail.com>2021-08-19 18:49:52 +0300
committerfidomax <adobegitler@gmail.com>2021-08-19 18:49:52 +0300
commit3327aef61974f940a1a1913371ec991151ed62fc (patch)
tree1e302ba68512acaa223ae2e6227348ca0159a8f1 /svr-chansession.c
parent89c8e695e9efad99947db3c1dac9790323423867 (diff)
downloaddropbear-3327aef61974f940a1a1913371ec991151ed62fc.tar.gz
keep LANG env variable for child process (#111)
Diffstat (limited to 'svr-chansession.c')
-rw-r--r--svr-chansession.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/svr-chansession.c b/svr-chansession.c
index 5128c4d..dde7e19 100644
--- a/svr-chansession.c
+++ b/svr-chansession.c
@@ -931,6 +931,11 @@ static void addchildpid(struct ChanSess *chansess, pid_t pid) {
static void execchild(const void *user_data) {
const struct ChanSess *chansess = user_data;
char *usershell = NULL;
+ char *cp = NULL;
+ char *envcp = getenv("LANG");
+ if (envcp != NULL) {
+ cp = m_strdup(envcp);
+ }
/* with uClinux we'll have vfork()ed, so don't want to overwrite the
* hostkey. can't think of a workaround to clear it */
@@ -991,6 +996,10 @@ static void execchild(const void *user_data) {
addnewvar("HOME", ses.authstate.pw_dir);
addnewvar("SHELL", get_user_shell());
addnewvar("PATH", DEFAULT_PATH);
+ if (cp != NULL) {
+ addnewvar("LANG", cp);
+ m_free(cp);
+ }
if (chansess->term != NULL) {
addnewvar("TERM", chansess->term);
}