Commit 9cd8d8f4 authored by Kevin ORourke's avatar Kevin ORourke Committed by Anas Nashif
Browse files

shell: backend: telnet: Don't assert if connection closed

The code in shell_ops.c that calls telnet_write will assert if it
returns non-zero. For a telnet shell it's normal that the
network might disconnect unexepectedly, so that should not
trigger an assert.

Fixes #67637

Link: https://github.com/zephyrproject-rtos/zephyr/issues/67637



Signed-off-by: default avatarKevin ORourke <kevin.orourke@ferroamp.se>
(cherry picked from commit 3399e061)
parent cea4a194
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -704,7 +704,12 @@ static int telnet_write(const struct shell_transport *transport,
			err = telnet_send(true);
			if (err != 0) {
				*cnt = length;
				return err;
				if ((err == -ENOTCONN) || (err == -ENETDOWN)) {
					LOG_ERR("Network disconnected, shutting down");
				} else {
					LOG_ERR("Error %d, shutting down", err);
				}
				return 0; /* Return 0 to not trigger ASSERT in shell_ops.c */
			}
		}