From 7b30383341a10be8cd142fa9bc63bf4373d2827e Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Tue, 1 May 2018 01:17:34 +0000
Subject: [PATCH] If a bundle file cannot be unpacked after 48-hours, if the
 file is 0-bytes in length, just delete it (don't rename to *.?_?).

---
 src/sbbs3/sbbsecho.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/sbbs3/sbbsecho.c b/src/sbbs3/sbbsecho.c
index 3deb4c4e71..934d797e2d 100644
--- a/src/sbbs3/sbbsecho.c
+++ b/src/sbbs3/sbbsecho.c
@@ -2690,10 +2690,14 @@ bool unpack_bundle(const char* inbound)
 			gi++;
 			lprintf(LOG_INFO,"Unpacking bundle: %s (%1.1fKB)", fname, flength(fname)/1024.0);
 			if(unpack(fname, inbound)) {	/* failure */
-				lprintf(LOG_ERR,"!Unpack failure");
+				lprintf(LOG_ERR, "!Unpack failure: %s", fname);
 				if(fdate(fname)+(48L*60L*60L)<time(NULL)) {	
-					/* If bundle file older than 48 hours, give up and rename
-					   to "*.?_?" or (if it exists) "*.?-?" */
+					/* If bundle file older than 48 hours, give up */
+					if(flength(fname) < 1) {
+						delfile(fname, __LINE__);	/* Delete it if it's a 0-byte file */
+						continue;
+					}
+					/* rename to "*.?_?" or (if it exists) "*.?-?" */
 					SAFECOPY(str,fname);
 					str[strlen(str)-2]='_';
 					if(fexistcase(str))
-- 
GitLab