Skip to content

Commit 9fc2192

Browse files
committed
Fix Test Term Size
When running the build tests, the terminal size gets set to 0x0. When then tests finish, things like vim start to misbehave until you change your term window size. 1. Echoserver will not change the terminal size when in echo mode. 2. Do not update the modes when the echo server is not in echo mode. 3. Update the guards around the above two items to match the guards for the modes update function.
1 parent fa648ec commit 9fc2192

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

examples/echoserver/echoserver.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -862,11 +862,16 @@ static int ssh_worker(thread_ctx_t* threadCtx)
862862
ChildRunning = 1;
863863
#endif
864864

865-
#if defined(WOLFSSH_TERM) && defined(WOLFSSH_SHELL)
866-
/* set initial size of terminal based on saved size */
865+
#if !defined(NO_TERMIOS) && defined(WOLFSSH_TERM)
867866
#if defined(HAVE_SYS_IOCTL_H)
868-
wolfSSH_DoModes(ssh->modes, ssh->modesSz, childFd);
869-
{
867+
#if defined(WOLFSSH_SHELL)
868+
if (!threadCtx->echo) {
869+
wolfSSH_DoModes(ssh->modes, ssh->modesSz, childFd);
870+
}
871+
#endif /* WOLFSSH_SHELL */
872+
873+
/* if not echoing, set initial size of terminal based on saved size */
874+
if (!threadCtx->echo) {
870875
struct winsize s = {0,0,0,0};
871876

872877
s.ws_col = ssh->widthChar;
@@ -879,7 +884,7 @@ static int ssh_worker(thread_ctx_t* threadCtx)
879884
#endif /* HAVE_SYS_IOCTL_H */
880885

881886
wolfSSH_SetTerminalResizeCtx(ssh, (void*)&childFd);
882-
#endif /* WOLFSSH_TERM && WOLFSSH_SHELL */
887+
#endif /* !NO_TERMIOS && WOLFSSH_TERM */
883888

884889
while (ChildRunning) {
885890
fd_set readFds;

0 commit comments

Comments
 (0)