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

Commit d2733712 authored by Rob Swindell's avatar Rob Swindell 💬

Address Coverity-reported issues

The use of uninitialized smb.retry_time was worst offender, but not expected to cause any actual issues.
parent 3c911b91
Pipeline #1818 passed with stage
in 16 minutes and 11 seconds
......@@ -549,7 +549,7 @@ bool upgrade_file_bases(bool hash)
for(int i = 0; i < scfg.total_dirs; i++) {
smb_t smb;
SAFEPRINTF2(smb.file, "%s%s", scfg.dir[i]->data_dir, scfg.dir[i]->code);
(void)smb_init_dir(&scfg, &smb, i);
if((result = smb_open(&smb)) != SMB_SUCCESS) {
fprintf(stderr, "Error %d (%s) opening %s\n", result, smb.last_error, smb.file);
return false;
......@@ -571,12 +571,14 @@ bool upgrade_file_bases(bool hash)
sprintf(str,"%s%s.ixb",scfg.dir[i]->data_dir,scfg.dir[i]->code);
if((file=open(str,O_RDONLY|O_BINARY))==-1) {
smb_close(&smb);
closeextdesc(extfile);
continue;
}
long l=(long)filelength(file);
if(!l) {
close(file);
smb_close(&smb);
closeextdesc(extfile);
continue;
}
uchar* ixbbuf;
......@@ -584,6 +586,7 @@ bool upgrade_file_bases(bool hash)
close(file);
printf("\7ERR_ALLOC %s %lu\n",str,l);
smb_close(&smb);
closeextdesc(extfile);
continue;
}
if(read(file,ixbbuf,l)!=(int)l) {
......@@ -591,6 +594,7 @@ bool upgrade_file_bases(bool hash)
printf("\7ERR_READ %s %lu\n",str,l);
free(ixbbuf);
smb_close(&smb);
closeextdesc(extfile);
continue;
}
close(file);
......@@ -598,6 +602,9 @@ bool upgrade_file_bases(bool hash)
oldfile_t* filelist = malloc(sizeof(*filelist) * file_count);
if(filelist == NULL) {
printf("malloc failure");
free(ixbbuf);
smb_close(&smb);
closeextdesc(extfile);
return false;
}
memset(filelist, 0, sizeof(*filelist) * file_count);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment