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

Fix error when moving files

e.g. file.cpp line 239 (removefile) removing "filename.zip" access=-203 info=smb_freemsgdat reading allocation record at offset 1108

Also, if there is an error removing the original file from the filebase, don't proceed to move the actual file (and log a successful move).
parent ab8bbf48
Branches
Tags
No related merge requests found
......@@ -244,6 +244,7 @@ bool sbbs_t::removefile(smb_t* smb, file_t* f)
/****************************************************************************/
bool sbbs_t::movefile(smb_t* smb, file_t* f, int newdir)
{
file_t orgfile = *f;
if(findfile(&cfg, newdir, f->name, NULL)) {
bprintf(text[FileAlreadyThere], f->name);
return false;
......@@ -251,7 +252,8 @@ bool sbbs_t::movefile(smb_t* smb, file_t* f, int newdir)
if(!addfile(&cfg, newdir, f, f->extdesc, /* client: */NULL))
return false;
removefile(smb, f);
if(!removefile(smb, &orgfile))
return false;
bprintf(text[MovedFile],f->name
,cfg.lib[cfg.dir[newdir]->lib]->sname,cfg.dir[newdir]->sname);
char str[MAX_PATH+1];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment