From ff1ebae7920c50df2855051c88323ebd9f049bfe Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Windows 11)" <rob@synchro.net>
Date: Mon, 3 Feb 2025 18:21:25 -0800
Subject: [PATCH] Add debug-level log messages when import_netmail() returns a
 non-zero value

To help debug any situations where import_netmail() might silently fail
(though I don't anticipate there are any, Accession suggested there was).
---
 src/sbbs3/sbbsecho.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/sbbs3/sbbsecho.c b/src/sbbs3/sbbsecho.c
index 939775e6d2..be03ba3c7c 100644
--- a/src/sbbs3/sbbsecho.c
+++ b/src/sbbs3/sbbsecho.c
@@ -6097,7 +6097,9 @@ void import_packets(const char* inbound, nodecfg_t* inbox, bool secure)
 
 			if (strncmp(fmsgbuf, "AREA:", 5) != 0) {                 /* Netmail */
 				(void)fseeko(fidomsg, msg_offset, SEEK_SET);
-				import_netmail("", &hdr, fidomsg, inbound);
+				result = import_netmail("", &hdr, fidomsg, inbound);
+				if (result != 0)
+					lprintf(LOG_DEBUG, "import_netmail() returned %d", result);
 				(void)fseeko(fidomsg, next_msg, SEEK_SET);
 				printf("\n");
 				continue;
@@ -7000,8 +7002,11 @@ int main(int argc, char **argv)
 					fclose(fidomsg);
 				}
 			}
-			else if (i != -2)
-				fclose(fidomsg);
+			else {
+				lprintf(LOG_DEBUG, "import_netmail(%s) returned %d", path, i);
+				if (i != -2)
+					fclose(fidomsg);
+			}
 			printf("\n");
 		}
 		globfree(&g);
-- 
GitLab