Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commits (3)
......@@ -228,8 +228,7 @@ bool sbbs_t::removefile(smb_t* smb, file_t* f)
int result;
if((result = smb_removefile(smb ,f)) == SMB_SUCCESS) {
SAFEPRINTF4(str,"%s removed %s from %s %s"
,useron.alias
SAFEPRINTF3(str,"removed %s from %s %s"
,f->name
,cfg.lib[cfg.dir[smb->dirnum]->lib]->sname,cfg.dir[smb->dirnum]->sname);
logline("U-",str);
......@@ -252,7 +251,7 @@ bool sbbs_t::movefile(smb_t* smb, file_t* f, int newdir)
if(!addfile(&cfg, newdir, f, f->extdesc, /* client: */NULL))
return false;
if(!removefile(smb, &orgfile))
if(!removefile(smb, &orgfile)) // Use ::removefile() here instead?
return false;
bprintf(text[MovedFile],f->name
,cfg.lib[cfg.dir[newdir]->lib]->sname,cfg.dir[newdir]->sname);
......@@ -308,12 +307,13 @@ bool sbbs_t::editfiledesc(file_t* f)
{
// Description
bputs(text[EditDescription]);
char fdesc[LEN_FDESC + 1];
SAFECOPY(fdesc, f->desc);
char fdesc[LEN_FDESC + 1] = "";
if(f->desc != NULL)
SAFECOPY(fdesc, f->desc);
getstr(fdesc, sizeof(fdesc)-1, K_LINE|K_EDIT|K_AUTODEL|K_TRIM);
if(msgabort(true))
return false;
if(strcmp(fdesc, f->desc) == 0)
if(f->desc != NULL && strcmp(fdesc, f->desc) == 0)
return true;
smb_new_hfield_str(f, SMB_FILEDESC, fdesc);
return updatefile(&cfg, f);
......
......@@ -460,7 +460,7 @@ bool updatefile(scfg_t* cfg, file_t* file)
if(smb_open_dir(cfg, &smb, file->dir) != SMB_SUCCESS)
return false;
int result = smb_updatemsg(&smb, file) == SMB_SUCCESS;
int result = smb_updatemsg(&smb, file);
smb_close(&smb);
return result == SMB_SUCCESS;
}
......
......@@ -844,39 +844,36 @@ int sbbs_t::listfileinfo(uint dirnum, const char *filespec, long mode)
editfileinfo(f);
break;
case 'F': /* delete file only */
SAFEPRINTF2(str,"%s%s",dirpath,f->name);
if(!fexistcase(str))
bprintf(text[FileDoesNotExist],str);
getfilepath(&cfg, f, path);
if(!fexistcase(path))
bprintf(text[FileDoesNotExist], path);
else {
if(!noyes(text[DeleteFileQ])) {
if(remove(str))
bprintf(text[CouldntRemoveFile],str);
else {
SAFEPRINTF(tmp, "deleted %s", str);
logline(nulstr, tmp);
}
if(remove(path) != 0) {
bprintf(text[CouldntRemoveFile], path);
errormsg(WHERE, ERR_REMOVE, path);
} else
lprintf(LOG_NOTICE, "deleted %s", path);
}
}
break;
case 'R': /* remove file from database */
if(noyes(text[RemoveFileQ]))
break;
if(removefile(&smb, f)) {
getfilepath(&cfg, f, path);
if(fexistcase(path)) {
if(dir_op(dirnum)) {
if(!noyes(text[DeleteFileQ])) {
if(remove(path) != 0)
errormsg(WHERE, ERR_REMOVE, path);
else {
SAFEPRINTF(tmp, "deleted %s", path);
logline(nulstr,path);
}
}
}
else if(remove(path)) /* always remove if not sysop */
bprintf(text[CouldntRemoveFile],path);
if(!removefile(&smb, f)) {
errormsg(WHERE, ERR_REMOVE, f->name);
break;
}
getfilepath(&cfg, f, path);
if(fexistcase(path)) {
if(dir_op(dirnum) && noyes(text[DeleteFileQ]))
break;
if(remove(path) != 0) {
bprintf(text[CouldntRemoveFile], path);
errormsg(WHERE, ERR_REMOVE, path);
break;
}
lprintf(LOG_NOTICE, "deleted %s", path);
}
if(dir_op(dirnum) || useron.exempt&FLAG('R')) {
i=cfg.lib[cfg.dir[f->dir]->lib]->offline_dir;
......