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

Add another flength() check before renaming bad QWK packets

To hopefully address:
!ERROR 2 (No such file or directory) renaming s:\sbbs\data\file/somenum.rep
 (-1 bytes) to s:\sbbs\data\file/somenum.rep.6777ed7c.bad

Clearly flength() is returning -1 (file doesn't exist) at this point, so
perhaps the call to fremove() just above updated a cached directory?
parent 6fee1eda
No related branches found
No related tags found
1 merge request!488Overhaul LZH code
......@@ -2975,7 +2975,7 @@ void event_thread(void* arg)
}
sbbs->lprintf(LOG_DEBUG, "Opened %s", lockfile.name);
if(!fexist(fname)) {
sbbs->lprintf(LOG_NOTICE, "%s already gone", fname);
sbbs->lprintf(LOG_DEBUG, "%s already gone", fname);
if(!fmutex_close(&lockfile))
sbbs->errormsg(WHERE, ERR_CLOSE, lockfile.name);
continue;
......@@ -2995,6 +2995,7 @@ void event_thread(void* arg)
char badpkt[MAX_PATH+1];
SAFEPRINTF2(badpkt, "%s.%" PRIx64 ".bad", fname, (uint64_t)time(NULL));
sbbs->fremove(WHERE, badpkt);
if(flength(fname) > 0) {
if(rename(fname, badpkt) == 0)
sbbs->lprintf(LOG_NOTICE, "%s renamed to %s", fname, badpkt);
else
......@@ -3004,6 +3005,7 @@ void event_thread(void* arg)
SAFEPRINTF(str,"%sfile/", sbbs->cfg.data_dir);
sbbs->delfiles(str, badpkt, /* keep: */10);
}
}
if(!fmutex_close(&lockfile))
sbbs->errormsg(WHERE, ERR_CLOSE, lockfile.name);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment