From 78e38999a19d82ffadd6c1866109cf02899bc609 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 13 Jan 2026 11:33:03 -0800 Subject: [PATCH] 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. --- examples/echoserver/echoserver.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index c98e8916f..cbf2662b4 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -862,24 +862,24 @@ static int ssh_worker(thread_ctx_t* threadCtx) ChildRunning = 1; #endif -#if defined(WOLFSSH_TERM) && defined(WOLFSSH_SHELL) - /* set initial size of terminal based on saved size */ +#if !defined(NO_TERMIOS) && defined(WOLFSSH_TERM) && defined(WOLFSSH_SHELL) #if defined(HAVE_SYS_IOCTL_H) - wolfSSH_DoModes(ssh->modes, ssh->modesSz, childFd); - { + /* if not echoing, set initial size of terminal based on saved size */ + if (!threadCtx->echo) { struct winsize s = {0,0,0,0}; + wolfSSH_DoModes(ssh->modes, ssh->modesSz, childFd); s.ws_col = ssh->widthChar; s.ws_row = ssh->heightRows; s.ws_xpixel = ssh->widthPixels; s.ws_ypixel = ssh->heightPixels; ioctl(childFd, TIOCSWINSZ, &s); - } -#endif /* HAVE_SYS_IOCTL_H */ wolfSSH_SetTerminalResizeCtx(ssh, (void*)&childFd); -#endif /* WOLFSSH_TERM && WOLFSSH_SHELL */ + } +#endif /* HAVE_SYS_IOCTL_H */ +#endif /* !NO_TERMIOS && WOLFSSH_TERM && WOLFSSH_SHELL */ while (ChildRunning) { fd_set readFds;