Skip to content

Commit 78e3899

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. Do not set the terminal update callback context when the echo server is not in echo mode. 4. Update the guards around the above three items to match the guards for the modes update function.
1 parent fa648ec commit 78e3899

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

examples/echoserver/echoserver.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -862,24 +862,24 @@ 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) && defined(WOLFSSH_SHELL)
867866
#if defined(HAVE_SYS_IOCTL_H)
868-
wolfSSH_DoModes(ssh->modes, ssh->modesSz, childFd);
869-
{
867+
/* if not echoing, set initial size of terminal based on saved size */
868+
if (!threadCtx->echo) {
870869
struct winsize s = {0,0,0,0};
871870

871+
wolfSSH_DoModes(ssh->modes, ssh->modesSz, childFd);
872872
s.ws_col = ssh->widthChar;
873873
s.ws_row = ssh->heightRows;
874874
s.ws_xpixel = ssh->widthPixels;
875875
s.ws_ypixel = ssh->heightPixels;
876876

877877
ioctl(childFd, TIOCSWINSZ, &s);
878-
}
879-
#endif /* HAVE_SYS_IOCTL_H */
880878

881879
wolfSSH_SetTerminalResizeCtx(ssh, (void*)&childFd);
882-
#endif /* WOLFSSH_TERM && WOLFSSH_SHELL */
880+
}
881+
#endif /* HAVE_SYS_IOCTL_H */
882+
#endif /* !NO_TERMIOS && WOLFSSH_TERM && WOLFSSH_SHELL */
883883

884884
while (ChildRunning) {
885885
fd_set readFds;

0 commit comments

Comments
 (0)