From 42e0893392d8833e879cc84dfd88a4299f10265d Mon Sep 17 00:00:00 2001 From: Producer Matt <58014742+ProducerMatt@users.noreply.github.com> Date: Thu, 28 Apr 2022 17:59:50 -0500 Subject: [PATCH] Unset stale SSH_TTY environment variable This variable would confuse devices that relied on it, such as the Clipetty extension for Emacs. See issue #1134 --- src/frontend/mosh-server.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc index e8a6cb70f..35aa7f5c5 100644 --- a/src/frontend/mosh-server.cc +++ b/src/frontend/mosh-server.cc @@ -570,6 +570,12 @@ static int run_server( const char *desired_ip, const char *desired_port, exit( 1 ); } + /* clear stale SSH_TTY environment variable */ + if ( unsetenv( "SSH_TTY" ) < 0 ) { + perror( "unsetenv" ); + exit( 1 ); + } + chdir_homedir(); if ( with_motd && (!motd_hushed()) ) {