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

Fix some crashes on multi-line description import stuff

Even though this is going to be removed / deprecated.
parent 314cd529
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1926 passed
...@@ -207,18 +207,18 @@ void addlist(char *inpath, uint dirnum, const char* uploader, uint dskip, uint s ...@@ -207,18 +207,18 @@ void addlist(char *inpath, uint dirnum, const char* uploader, uint dskip, uint s
if(datefmt) { if(datefmt) {
struct tm tm = {0}; struct tm tm = {0};
localtime_r(&now, &tm); localtime_r(&now, &tm);
strftime(f.desc, sizeof(f.desc), datefmt, &tm); strftime(fdesc, sizeof(fdesc), datefmt, &tm);
} else } else
unixtodstr(&scfg, (time32_t)now, f.desc); unixtodstr(&scfg, (time32_t)now, fdesc);
SAFECAT(fdesc," "); SAFECAT(fdesc," ");
} }
else if(mode&FILE_DATE) { /* get the file date and put into desc */ else if(mode&FILE_DATE) { /* get the file date and put into desc */
if(datefmt) { if(datefmt) {
struct tm tm = {0}; struct tm tm = {0};
localtime_r(&file_timestamp, &tm); localtime_r(&file_timestamp, &tm);
strftime(f.desc, sizeof(f.desc), datefmt, &tm); strftime(fdesc, sizeof(fdesc), datefmt, &tm);
} else } else
unixtodstr(&scfg,(time32_t)file_timestamp,f.desc); unixtodstr(&scfg,(time32_t)file_timestamp,fdesc);
SAFECAT(fdesc," "); SAFECAT(fdesc," ");
} }
...@@ -363,8 +363,8 @@ void addlist(char *inpath, uint dirnum, const char* uploader, uint dskip, uint s ...@@ -363,8 +363,8 @@ void addlist(char *inpath, uint dirnum, const char* uploader, uint dskip, uint s
p[i-1]=0; p[i-1]=0;
truncsp(p); truncsp(p);
if(p[0]) { if(p[0]) {
SAFECAT(f.desc," "); SAFECAT(fdesc," ");
SAFECAT(f.desc,p); SAFECAT(fdesc,p);
} }
} }
} }
...@@ -836,6 +836,7 @@ int main(int argc, char **argv) ...@@ -836,6 +836,7 @@ int main(int argc, char **argv)
sprintf(str,"%s%s.lst",scfg.dir[dirnum]->path, scfg.dir[dirnum]->code); sprintf(str,"%s%s.lst",scfg.dir[dirnum]->path, scfg.dir[dirnum]->code);
if(!fexistcase(str) || flength(str)<=0L) if(!fexistcase(str) || flength(str)<=0L)
SAFEPRINTF2(str,"%s%s",scfg.dir[dirnum]->path, auto_name); SAFEPRINTF2(str,"%s%s",scfg.dir[dirnum]->path, auto_name);
addlist(str, dirnum, uploader, desc_offset, size_offset);
if(mode&SYNC_LIST) if(mode&SYNC_LIST)
synclist(str, dirnum); synclist(str, dirnum);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment