at v192 1.1 kB view raw
1diff --git a/svr-chansession.c b/svr-chansession.c 2index 23dad8c..32cac13 100644 3--- a/svr-chansession.c 4+++ b/svr-chansession.c 5@@ -823,6 +823,7 @@ static void addchildpid(struct ChanSess *chansess, pid_t pid) { 6 static void execchild(void *user_data) { 7 struct ChanSess *chansess = user_data; 8 char *usershell = NULL; 9+ const char *path = DEFAULT_PATH; 10 11 /* with uClinux we'll have vfork()ed, so don't want to overwrite the 12 * hostkey. can't think of a workaround to clear it */ 13@@ -835,6 +836,9 @@ static void execchild(void *user_data) { 14 reseedrandom(); 15 #endif 16 17+ if (getenv("PATH")) 18+ path = getenv("PATH"); 19+ 20 /* clear environment */ 21 /* if we're debugging using valgrind etc, we need to keep the LD_PRELOAD 22 * etc. This is hazardous, so should only be used for debugging. */ 23@@ -878,7 +882,7 @@ static void execchild(void *user_data) { 24 addnewvar("LOGNAME", ses.authstate.pw_name); 25 addnewvar("HOME", ses.authstate.pw_dir); 26 addnewvar("SHELL", get_user_shell()); 27- addnewvar("PATH", DEFAULT_PATH); 28+ addnewvar("PATH", path); 29 if (chansess->term != NULL) { 30 addnewvar("TERM", chansess->term); 31 }