summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorfidomax <adobegitler@gmail.com>2021-08-19 18:49:52 +0300
committerGitHub <noreply@github.com>2021-08-19 23:49:52 +0800
commit41d4b4e7f791825b8e5b2979e49bc0f5409380e9 (patch)
treebd5a5f4e510a809347a204b4ce2efe7998c70e7a
parentdc016f900be7ada4f3e3753d16163097c210e424 (diff)
keep LANG env variable for child process (#111)HEADmaster
-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);
}