From 46cdfc570ddad8d2fb9ed283ca76ace217a106d5 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Sat, 3 Feb 2024 00:24:04 -0700 Subject: [PATCH] set pipes as non blocking before last read --- apps/wolfsshd/wolfsshd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/wolfsshd/wolfsshd.c b/apps/wolfsshd/wolfsshd.c index 6b9c9e1d4..a7ef2f0a5 100644 --- a/apps/wolfsshd/wolfsshd.c +++ b/apps/wolfsshd/wolfsshd.c @@ -1606,11 +1606,15 @@ static int SHELL_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh, if (forcedCmd) { int readSz; + fcntl(stdoutPipe[0], F_SETFL, fcntl(stdoutPipe[0], F_GETFL) + | O_NONBLOCK); readSz = (int)read(stdoutPipe[0], shellBuffer, sizeof shellBuffer); if (readSz > 0) { wolfSSH_ChannelIdSend(ssh, shellChannelId, shellBuffer, readSz); } + fcntl(stderrPipe[0], F_SETFL, fcntl(stderrPipe[0], F_GETFL) + | O_NONBLOCK); readSz = (int)read(stderrPipe[0], shellBuffer, sizeof shellBuffer); if (readSz > 0) { wolfSSH_extended_data_send(ssh, shellBuffer, readSz);