From ad1520fd9f49c13a0cb037ec91c4322fc94e2b70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Fri, 29 Dec 2023 13:16:57 -0500
Subject: [PATCH] Don't log error on final channel message

---
 src/sbbs3/main.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index 94f407dd5c..be9f66fc1a 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -1939,7 +1939,13 @@ static int crypt_pop_channel_data(sbbs_t *sbbs, char *inbuf, int want, int *got)
 				}
 			}
 			else {
-				GCESS(status, sbbs->client_socket, sbbs->ssh_session, "getting channel id");
+				/*
+				 * CRYPT_ERROR_NOTFOUND indicates this is the last data on the channel (whatever it was)
+				 * and it was destroyed, so it's no longer possible to get the channel id.
+				 */
+				if (status != CRYPT_ERROR_NOTFOUND)
+					GCESS(status, sbbs->client_socket, sbbs->ssh_session, "getting channel id");
+				closing_channel = -1;
 			}
 		}
 		if (ret == CRYPT_ENVELOPE_RESOURCE)
-- 
GitLab