keep LANG env variable for child process (#111)

This commit is contained in:
fidomax 2021-08-19 18:49:52 +03:00 committed by GitHub
parent dc016f900b
commit 41d4b4e7f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}