Skip to content
Snippets Groups Projects
Commit 2245523d authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Better error handling in QWK packet creation

If libarchive creates a 0-byte file or no file at all, then fall-through to the "temp file command-line" (if there is at least one Compressible File Type configured).

If libarchive fails, there will still be a (hopefully helpful) error message logged, but at least the QWK packet may still get created.
parent 04a41e14
Branches
Tags
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2366 passed
...@@ -727,6 +727,7 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack) ...@@ -727,6 +727,7 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
/*******************/ /*******************/
/* Compress Packet */ /* Compress Packet */
/*******************/ /*******************/
remove(packet);
SAFEPRINTF2(path,"%s%s",cfg.temp_dir,ALLFILES); SAFEPRINTF2(path,"%s%s",cfg.temp_dir,ALLFILES);
if(strListFind((str_list_t)supported_archive_formats, useron.tmpext, /* case_sensitive */FALSE) >= 0) { if(strListFind((str_list_t)supported_archive_formats, useron.tmpext, /* case_sensitive */FALSE) >= 0) {
str_list_t file_list = directory(path); str_list_t file_list = directory(path);
...@@ -736,13 +737,15 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack) ...@@ -736,13 +737,15 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
lprintf(LOG_ERR, "libarchive error (%s) creating %s", error, packet); lprintf(LOG_ERR, "libarchive error (%s) creating %s", error, packet);
else else
lprintf(LOG_INFO, "libarchive created %s from %ld files", packet, file_count); lprintf(LOG_INFO, "libarchive created %s from %ld files", packet, file_count);
} else { }
if(flength(packet) < 1) {
remove(packet);
if((i = external(cmdstr(temp_cmd(),packet,path,NULL), ex|EX_WILDCARD)) != 0) if((i = external(cmdstr(temp_cmd(),packet,path,NULL), ex|EX_WILDCARD)) != 0)
errormsg(WHERE,ERR_EXEC,cmdstr(temp_cmd(),packet,path,NULL),i); errormsg(WHERE,ERR_EXEC,cmdstr(temp_cmd(),packet,path,NULL),i);
} if(flength(packet) < 1) {
if(!fexist(packet)) { bputs(text[QWKCompressionFailed]);
bputs(text[QWKCompressionFailed]); return(false);
return(false); }
} }
if(!prepack && useron.rest&FLAG('Q')) { if(!prepack && useron.rest&FLAG('Q')) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment