From 41d4b4e7f791825b8e5b2979e49bc0f5409380e9 Mon Sep 17 00:00:00 2001 From: fidomax Date: Thu, 19 Aug 2021 18:49:52 +0300 Subject: keep LANG env variable for child process (#111) --- svr-chansession.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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); } -- cgit v1.2.3