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

Fix the file update support a bit.

This is still broken (errors when updating existing files) and is still planned for deprecation.
parent bc883458
Branches
Tags
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -107,7 +107,7 @@ void updatestats(ulong size) ...@@ -107,7 +107,7 @@ void updatestats(ulong size)
bool reupload(smb_t* smb, file_t* f) bool reupload(smb_t* smb, file_t* f)
{ {
char path[MAX_PATH + 1]; char path[MAX_PATH + 1];
if(!smb_renewfile(smb, f, SMB_SELFPACK, getfilepath(&scfg, f, path))) { if(smb_renewfile(smb, f, SMB_SELFPACK, getfilepath(&scfg, f, path)) != SMB_SUCCESS) {
fprintf(stderr, "!Error renewing: %s\n", f->name); fprintf(stderr, "!Error renewing: %s\n", f->name);
return false; return false;
} }
...@@ -313,6 +313,7 @@ void addlist(char *inpath, uint dirnum, const char* uploader, uint dskip, uint s ...@@ -313,6 +313,7 @@ void addlist(char *inpath, uint dirnum, const char* uploader, uint dskip, uint s
} }
time_t file_timestamp = fdate(filepath); time_t file_timestamp = fdate(filepath);
memset(&f, 0, sizeof(f));
exist = smb_findfile(&smb, fname, &f) == SMB_SUCCESS; exist = smb_findfile(&smb, fname, &f) == SMB_SUCCESS;
if(exist) { if(exist) {
if(mode&NO_UPDATE) if(mode&NO_UPDATE)
...@@ -403,7 +404,6 @@ void addlist(char *inpath, uint dirnum, const char* uploader, uint dskip, uint s ...@@ -403,7 +404,6 @@ void addlist(char *inpath, uint dirnum, const char* uploader, uint dskip, uint s
prep_file_desc(fdesc, fdesc); prep_file_desc(fdesc, fdesc);
if(mode&ASCII_ONLY) if(mode&ASCII_ONLY)
strip_exascii(fdesc, fdesc); strip_exascii(fdesc, fdesc);
memset(&f, 0, sizeof(f));
uint32_t cdt = (uint32_t)l; uint32_t cdt = (uint32_t)l;
smb_hfield_bin(&f, SMB_COST, cdt); smb_hfield_bin(&f, SMB_COST, cdt);
smb_hfield_str(&f, SMB_FILENAME, fname); smb_hfield_str(&f, SMB_FILENAME, fname);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment