changeset 1824:1edf4f143e12 default tip main master

keep LANG env variable for child process (#111)
author fidomax <adobegitler@gmail.com>
date Thu, 19 Aug 2021 18:49:52 +0300
parents 401d7d8c8a79
children
files svr-chansession.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/svr-chansession.c	Thu Aug 19 18:40:58 2021 +0300
+++ b/svr-chansession.c	Thu Aug 19 18:49:52 2021 +0300
@@ -931,6 +931,11 @@
 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 @@
 	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);
 	}