Skip to content

Commit 72e6c26

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 72e6c26

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/echoserver/echoserver.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -862,13 +862,13 @@ 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;
@@ -879,7 +879,7 @@ static int ssh_worker(thread_ctx_t* threadCtx)
879879
#endif /* HAVE_SYS_IOCTL_H */
880880

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

884884
while (ChildRunning) {
885885
fd_set readFds;

0 commit comments

Comments
 (0)