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 40953725 authored by Rob Swindell's avatar Rob Swindell 💬

More Coverity issues addressed.

parent 7203eb80
Pipeline #1351 passed with stage
in 9 minutes and 53 seconds
......@@ -209,8 +209,10 @@ bool sbbs_t::ansi_getxy(int* x, int* y)
int ch;
char str[128];
*x=0;
*y=0;
if(x != NULL)
*x=0;
if(y != NULL)
*y=0;
putcom("\x1b[6n"); /* Request cursor position */
......
......@@ -608,10 +608,10 @@ long sbbs_t::js_execfile(const char *cmd, const char* startup_dir, JSObject* sco
if(js_scope!=NULL) {
if (scope != NULL) {
JS_GetProperty(js_cx, scope, "argv", &old_js_argv);
JS_AddValueRoot(js_cx, &old_js_argv);
JS_GetProperty(js_cx, scope, "argc", &old_js_argc);
JS_AddValueRoot(js_cx, &old_js_argc);
if(JS_GetProperty(js_cx, scope, "argv", &old_js_argv))
JS_AddValueRoot(js_cx, &old_js_argv);
if(JS_GetProperty(js_cx, scope, "argc", &old_js_argc))
JS_AddValueRoot(js_cx, &old_js_argc);
}
JSObject* argv=JS_NewArrayObject(js_cx, 0, NULL);
......
/* execfunc.cpp */
/* Hi-level command shell/module routines (functions) */
/* $Id: execfunc.cpp,v 1.46 2020/05/14 07:49:59 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -17,21 +13,9 @@
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -268,7 +252,7 @@ int sbbs_t::exec_function(csi_t *csi)
bputs(text[ErrorLogHdr]);
printfile(str,0);
if(text[DeleteErrorLogQ][0] && !noyes(text[DeleteErrorLogQ]))
remove(str);
(void)remove(str);
}
else
bprintf(text[FileDoesNotExist],str);
......
......@@ -24,28 +24,6 @@
#include "sbbs.h"
#include "qwk.h"
void pt_zone_kludge(fmsghdr_t hdr,int fido)
{
char str[256];
sprintf(str,"\1INTL %hu:%hu/%hu %hu:%hu/%hu\r"
,hdr.destzone,hdr.destnet,hdr.destnode
,hdr.origzone,hdr.orignet,hdr.orignode);
write(fido,str,strlen(str));
if(hdr.destpoint) {
sprintf(str,"\1TOPT %hu\r"
,hdr.destpoint);
write(fido,str,strlen(str));
}
if(hdr.origpoint) {
sprintf(str,"\1FMPT %hu\r"
,hdr.origpoint);
write(fido,str,strlen(str));
}
}
bool sbbs_t::lookup_netuser(char *into)
{
char to[128],name[26],str[256],q[128];
......
/* Synchronet file transfer-related functions */
/* $Id: file.cpp,v 1.36 2019/08/12 06:24:08 rswindell Exp $ */
// vi: tabstop=4
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -16,21 +13,9 @@
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -122,7 +107,7 @@ void sbbs_t::openfile(file_t* f)
errormsg(WHERE,ERR_OPEN,str1,O_RDWR);
return;
}
lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
(void)lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
if(read(file,str2,3)!=3) {
close(file);
errormsg(WHERE,ERR_READ,str1,3);
......@@ -131,7 +116,7 @@ void sbbs_t::openfile(file_t* f)
str2[3]=0;
ultoa(atoi(str2)+1,str3,10);
putrec(str2,0,3,str3);
lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
(void)lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
if(write(file,str2,3)!=3) {
close(file);
errormsg(WHERE,ERR_WRITE,str1,3);
......@@ -172,7 +157,7 @@ void sbbs_t::closefile(file_t* f)
errormsg(WHERE,ERR_OPEN,str1,O_RDWR);
return;
}
lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
(void)lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
if(read(file,str2,3)!=3) {
close(file);
errormsg(WHERE,ERR_READ,str1,3);
......@@ -183,7 +168,7 @@ void sbbs_t::closefile(file_t* f)
if(ch) ch--;
ultoa(ch,str3,10);
putrec(str2,0,3,str3);
lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
(void)lseek(file,f->datoffset+F_OPENCOUNT,SEEK_SET);
if(write(file,str2,3)!=3) {
close(file);
errormsg(WHERE,ERR_WRITE,str1,3);
......
......@@ -122,7 +122,7 @@ BOOL direxist(char *dir)
BOOL dir_op(scfg_t* cfg, user_t* user, client_t* client, uint dirnum)
{
return(user->level>=SYSOP_LEVEL
|| (cfg->dir[dirnum]->op_ar!=NULL && cfg->dir[dirnum]->op_ar[0] && chk_ar(cfg,cfg->dir[dirnum]->op_ar,user,client)));
|| (cfg->dir[dirnum]->op_ar[0] && chk_ar(cfg,cfg->dir[dirnum]->op_ar,user,client)));
}
#if defined(__GNUC__) // Catch printf-format errors with lprintf
......@@ -678,7 +678,7 @@ static void send_thread(void* arg)
,xfer.ctrl_sock, xfer.user->alias, xfer.filename, length);
sockprintf(xfer.ctrl_sock,xfer.ctrl_sess,"450 Invalid file size: %"PRIdOFF, length);
if(xfer.tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(xfer.ctrl_sock, __LINE__, xfer.filename, xfer.user->alias);
(void)ftp_remove(xfer.ctrl_sock, __LINE__, xfer.filename, xfer.user->alias);
ftp_close_socket(xfer.data_sock,xfer.data_sess,__LINE__);
*xfer.inprogress=FALSE;
thread_down();
......@@ -691,7 +691,7 @@ static void send_thread(void* arg)
,xfer.ctrl_sock, xfer.user->alias, errno, strerror(errno), __LINE__, xfer.filename);
sockprintf(xfer.ctrl_sock,xfer.ctrl_sess,"450 ERROR %d (%s) opening %s", errno, strerror(errno), xfer.filename);
if(xfer.tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(xfer.ctrl_sock, __LINE__, xfer.filename, xfer.user->alias);
(void)ftp_remove(xfer.ctrl_sock, __LINE__, xfer.filename, xfer.user->alias);
ftp_close_socket(xfer.data_sock,xfer.data_sess,__LINE__);
*xfer.inprogress=FALSE;
thread_down();
......@@ -709,7 +709,7 @@ static void send_thread(void* arg)
lprintf(LOG_DEBUG,"%04d <%s> DATA socket %d sending %s from offset %"PRIdOFF
,xfer.ctrl_sock, xfer.user->alias, *xfer.data_sock,xfer.filename,xfer.filepos);
fseek(fp,xfer.filepos,SEEK_SET);
(void)fseek(fp,xfer.filepos,SEEK_SET);
last_report=start=time(NULL);
while((xfer.filepos+total)<length) {
......@@ -760,7 +760,7 @@ static void send_thread(void* arg)
if(i<1)
continue;
fseek(fp,xfer.filepos+total,SEEK_SET);
(void)fseek(fp,xfer.filepos+total,SEEK_SET);
rd=fread(buf,sizeof(char),sizeof(buf),fp);
if(rd<1) /* EOF or READ error */
break;
......@@ -917,10 +917,10 @@ static void send_thread(void* arg)
*xfer.inprogress=FALSE;
if(xfer.tmpfile) {
if(!(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(xfer.ctrl_sock, __LINE__, xfer.filename, xfer.user->alias);
(void)ftp_remove(xfer.ctrl_sock, __LINE__, xfer.filename, xfer.user->alias);
}
else if(xfer.delfile && !error)
ftp_remove(xfer.ctrl_sock, __LINE__, xfer.filename, xfer.user->alias);
(void)ftp_remove(xfer.ctrl_sock, __LINE__, xfer.filename, xfer.user->alias);
#if defined(SOCKET_DEBUG_SENDTHREAD)
socket_debug[xfer.ctrl_sock]&=~SOCKET_DEBUG_SENDTHREAD;
......@@ -986,7 +986,7 @@ static void receive_thread(void* arg)
lprintf(LOG_DEBUG,"%04d <%s> DATA socket %d receiving %s from offset %"PRIdOFF
,xfer.ctrl_sock,xfer.user->alias, *xfer.data_sock,xfer.filename,xfer.filepos);
fseek(fp,xfer.filepos,SEEK_SET);
(void)fseek(fp,xfer.filepos,SEEK_SET);
last_report=start=time(NULL);
while(1) {
......@@ -1119,7 +1119,7 @@ static void receive_thread(void* arg)
}
if(error) {
if(!xfer.append)
ftp_remove(xfer.ctrl_sock, __LINE__, xfer.filename, xfer.user->alias);
(void)ftp_remove(xfer.ctrl_sock, __LINE__, xfer.filename, xfer.user->alias);
} else {
dur=(long)(time(NULL)-start);
cps=dur ? total/dur : total*2;
......@@ -1160,14 +1160,14 @@ static void receive_thread(void* arg)
if(i<scfg.total_fextrs) {
sprintf(tmp,"%sFILE_ID.DIZ",scfg.temp_dir);
if(fexistcase(tmp))
ftp_remove(xfer.ctrl_sock, __LINE__, tmp, xfer.user->alias);
(void)ftp_remove(xfer.ctrl_sock, __LINE__, tmp, xfer.user->alias);
cmdstr(&scfg,xfer.user,scfg.fextr[i]->cmd,fname,"FILE_ID.DIZ",cmd);
lprintf(LOG_DEBUG,"%04d <%s> DATA Extracting DIZ: %s",xfer.ctrl_sock, xfer.user->alias,cmd);
system(cmd);
if(!fexistcase(tmp)) {
sprintf(tmp,"%sDESC.SDI",scfg.temp_dir);
if(fexistcase(tmp))
ftp_remove(xfer.ctrl_sock, __LINE__, tmp, xfer.user->alias);
(void)ftp_remove(xfer.ctrl_sock, __LINE__, tmp, xfer.user->alias);
cmdstr(&scfg,xfer.user,scfg.fextr[i]->cmd,fname,"DESC.SDI",cmd);
lprintf(LOG_DEBUG,"%04d <%s> DATA Extracting DIZ: %s",xfer.ctrl_sock, xfer.user->alias,cmd);
system(cmd);
......@@ -1191,7 +1191,7 @@ static void receive_thread(void* arg)
SAFECOPY(f.desc,desc+i);
}
close(file);
ftp_remove(xfer.ctrl_sock, __LINE__, tmp, xfer.user->alias);
(void)ftp_remove(xfer.ctrl_sock, __LINE__, tmp, xfer.user->alias);
f.misc|=FM_EXTDESC;
} else
lprintf(LOG_DEBUG,"%04d <%s> DATA DIZ Does not exist: %s",xfer.ctrl_sock, xfer.user->alias,tmp);
......@@ -1286,7 +1286,7 @@ static BOOL start_tls(SOCKET *sock, CRYPT_SESSION *sess, BOOL resp)
return FALSE;
}
nodelay = TRUE;
setsockopt(*sock,IPPROTO_TCP,TCP_NODELAY,(char*)&nodelay,sizeof(nodelay));
(void)setsockopt(*sock,IPPROTO_TCP,TCP_NODELAY,(char*)&nodelay,sizeof(nodelay));
nb=0;
ioctlsocket(*sock,FIONBIO,&nb);
if ((status = cryptSetAttribute(*sess, CRYPT_SESSINFO_NETWORKSOCKET, *sock)) != CRYPT_OK) {
......@@ -1341,7 +1341,7 @@ static void filexfer(union xp_sockaddr* addr, SOCKET ctrl_sock, CRYPT_SESSION ct
lprintf(LOG_WARNING,"%04d <%s> !DATA TRANSFER already in progress",ctrl_sock, user->alias);
sockprintf(ctrl_sock,ctrl_sess,"425 Transfer already in progress.");
if(tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
(void)ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
return;
}
*inprogress=TRUE;
......@@ -1356,7 +1356,7 @@ static void filexfer(union xp_sockaddr* addr, SOCKET ctrl_sock, CRYPT_SESSION ct
lprintf(LOG_ERR,"%04d <%s> !DATA ERROR %d opening socket", ctrl_sock, user->alias, ERROR_VALUE);
sockprintf(ctrl_sock,ctrl_sess,"425 Error %d opening socket",ERROR_VALUE);
if(tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
(void)ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
*inprogress=FALSE;
return;
}
......@@ -1367,7 +1367,7 @@ static void filexfer(union xp_sockaddr* addr, SOCKET ctrl_sock, CRYPT_SESSION ct
/* Use port-1 for all data connections */
reuseaddr=TRUE;
setsockopt(*data_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&reuseaddr,sizeof(reuseaddr));
(void)setsockopt(*data_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&reuseaddr,sizeof(reuseaddr));
addr_len = sizeof(server_addr);
if((result=getsockname(ctrl_sock, &server_addr.addr,&addr_len))!=0) {
......@@ -1388,7 +1388,7 @@ static void filexfer(union xp_sockaddr* addr, SOCKET ctrl_sock, CRYPT_SESSION ct
,ctrl_sock, user->alias, result, ERROR_VALUE, *data_sock);
sockprintf(ctrl_sock,ctrl_sess,"425 Error %d binding socket",ERROR_VALUE);
if(tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
(void)ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
*inprogress=FALSE;
ftp_close_socket(data_sock,data_sess,__LINE__);
return;
......@@ -1401,7 +1401,7 @@ static void filexfer(union xp_sockaddr* addr, SOCKET ctrl_sock, CRYPT_SESSION ct
,host_ip,inet_addrport(addr),*data_sock);
sockprintf(ctrl_sock,ctrl_sess,"425 Error %d connecting to socket",ERROR_VALUE);
if(tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
(void)ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
*inprogress=FALSE;
ftp_close_socket(data_sock,data_sess,__LINE__);
return;
......@@ -1416,7 +1416,7 @@ static void filexfer(union xp_sockaddr* addr, SOCKET ctrl_sock, CRYPT_SESSION ct
,ctrl_sock, user->alias);
sockprintf(ctrl_sock,ctrl_sess,"425 Error activating TLS");
if(tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
(void)ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
*inprogress=FALSE;
ftp_close_socket(data_sock,data_sess,__LINE__);
return;
......@@ -1453,7 +1453,7 @@ static void filexfer(union xp_sockaddr* addr, SOCKET ctrl_sock, CRYPT_SESSION ct
,ctrl_sock, user->alias,result,ERROR_VALUE);
sockprintf(ctrl_sock,ctrl_sess,"425 Error %d selecting socket for connection",ERROR_VALUE);
if(tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
(void)ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
*inprogress=FALSE;
return;
}
......@@ -1471,7 +1471,7 @@ static void filexfer(union xp_sockaddr* addr, SOCKET ctrl_sock, CRYPT_SESSION ct
,ctrl_sock, user->alias,ERROR_VALUE,pasv_sock);
sockprintf(ctrl_sock,ctrl_sess,"425 Error %d accepting connection",ERROR_VALUE);
if(tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
(void)ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
*inprogress=FALSE;
return;
}
......@@ -1485,7 +1485,7 @@ static void filexfer(union xp_sockaddr* addr, SOCKET ctrl_sock, CRYPT_SESSION ct
lprintf(LOG_WARNING,"%04d <%s> PASV !DATA ERROR starting TLS", pasv_sock, user->alias);
sockprintf(ctrl_sock,ctrl_sess,"425 Error negotiating TLS");
if(tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
(void)ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
*inprogress=FALSE;
return;
}
......@@ -1540,7 +1540,7 @@ static void filexfer(union xp_sockaddr* addr, SOCKET ctrl_sock, CRYPT_SESSION ct
/* failure */
if(tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
(void)ftp_remove(ctrl_sock, __LINE__, filename, user->alias);
*inprogress=FALSE;
}
......@@ -1647,7 +1647,7 @@ static BOOL ftpalias(char* fullalias, char* filename, user_t* user, client_t* cl
sprintf(filename,"%s%s",scfg.dir[dir]->path,fname);
}
} else if(filename!=NULL)
strcpy(filename,p);
SAFECOPY(filename,p);
result=TRUE; /* success */
break;
......@@ -1720,7 +1720,7 @@ static int parsepath(char** pp, user_t* user, client_t* client, int* curlib, int
}
}
if (lib == scfg.total_libs) {
strcpy(filename, p);
SAFECOPY(filename, p);
tmp = strchr(filename, '/');
if (tmp != NULL)
*tmp = 0;
......@@ -4328,13 +4328,13 @@ static void ctrl_thread(void* arg)
if(!socket_check(sock,NULL,NULL,0)) {
lprintf(LOG_NOTICE,"%04d <%s> disconnected while waiting for QWK packet creation"
,sock, user.alias);
ftp_remove(sock, __LINE__, str, user.alias);
(void)ftp_remove(sock, __LINE__, str, user.alias);
continue;
}
if(fexist(str)) {
lprintf(LOG_WARNING,"%04d <%s> !TIMEOUT waiting for QWK packet creation", sock, user.alias);
sockprintf(sock,sess,"451 Time-out waiting for packet creation.");
ftp_remove(sock, __LINE__, str, user.alias);
(void)ftp_remove(sock, __LINE__, str, user.alias);
filepos=0;
continue;
}
......
......@@ -22,7 +22,27 @@
#include "sbbs.h"
#include "qwk.h"
void pt_zone_kludge(fmsghdr_t hdr,int fido);
static void pt_zone_kludge(const fmsghdr_t* hdr,int fido)
{
char str[256];
sprintf(str,"\1INTL %hu:%hu/%hu %hu:%hu/%hu\r"
,hdr->destzone,hdr->destnet,hdr->destnode
,hdr->origzone,hdr->orignet,hdr->orignode);
write(fido,str,strlen(str));
if(hdr->destpoint) {
sprintf(str,"\1TOPT %hu\r"
,hdr->destpoint);
write(fido,str,strlen(str));
}
if(hdr->origpoint) {
sprintf(str,"\1FMPT %hu\r"
,hdr->origpoint);
write(fido,str,strlen(str));
}
}
/****************************************************************************/
/* Returns the FidoNet address (struct) parsed from str (in ASCII text). */
......@@ -854,7 +874,7 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub)
}
write(fido,&hdr,sizeof(hdr));
pt_zone_kludge(hdr,fido);
pt_zone_kludge(&hdr,fido);
if(cfg.netmail_misc&NMAIL_DIRECT) {
sprintf(str,"\1FLAGS DIR\r\n");
......
......@@ -2219,8 +2219,10 @@ int getuserrec(scfg_t* cfg, int usernumber,int start, int length, char *str)
if(length < 1) { /* auto-length */
length=user_rec_len(start);
if(length < 1)
if(length < 1) {
close(file);
return -5;
}
}
i=0;
......@@ -2341,8 +2343,10 @@ ulong adjustuserrec(scfg_t* cfg, int usernumber, int start, int length, long adj
if(length < 1) { /* auto-length */
length=user_rec_len(start);
if(length < 1)
if(length < 1) {
close(file);
return 0;
}
}
i=0;
......
......@@ -1465,6 +1465,7 @@ int sbbs_t::external(const char* cmdline, long mode, const char* startup_dir)
SAFEPRINTF(str,"%sdosemu.ini",cfg.exec_dir);
if (!fexist(str)) {
errormsg(WHERE,ERR_OPEN,"dosemu.ini", 0);
fclose(dosemubatfp);
return(-1);
}
}
......@@ -1472,6 +1473,7 @@ int sbbs_t::external(const char* cmdline, long mode, const char* startup_dir)
/* if file found, then open and process it */
if ((de_launch_inifp=iniOpenFile(str, false))==NULL) {
errormsg(WHERE,ERR_OPEN,str, 0);
fclose(dosemubatfp);
return(-1);
}
de_launch_ini = iniReadFile(de_launch_inifp);
......
......@@ -869,7 +869,7 @@ int zmodem_recv_data32(zmodem_t* zm, unsigned char * p, unsigned maxlen, unsigne
rxd_crc |= zmodem_rx(zm) << 24;
if(rxd_crc != crc) {
lprintf(zm, LOG_DEBUG, "%lu %s CRC ERROR (%08lX, expected: %08lX) Bytes=%u, subpacket type=%s"
lprintf(zm, LOG_DEBUG, "%lu %s CRC ERROR (%08X, expected: %08X) Bytes=%u, subpacket type=%s"
,(ulong)zm->ack_file_pos, __FUNCTION__, rxd_crc, crc, *len, chr(subpkt_type));
return CRCFAILED;
}
......@@ -1205,7 +1205,7 @@ BOOL zmodem_recv_bin32_header(zmodem_t* zm)
rxd_crc |= zmodem_rx(zm) << 24;
if(rxd_crc != crc) {
lprintf(zm,LOG_WARNING, "%lu %s CRC ERROR (%08lX, expected: %08lX)"
lprintf(zm,LOG_WARNING, "%lu %s CRC ERROR (%08X, expected: %08X)"
,(ulong)zm->ack_file_pos, __FUNCTION__, rxd_crc, crc);
return(FALSE);
}
......@@ -1515,7 +1515,7 @@ BOOL zmodem_handle_zrpos(zmodem_t* zm, uint64_t* pos)
zmodem_recv_purge(zm, /* timeout: */1);
return TRUE;
}
lprintf(zm, LOG_WARNING, "%lu Received INVALID ZRPOS offset: %lu"
lprintf(zm, LOG_WARNING, "%lu Received INVALID ZRPOS offset: %u"
,(ulong)zm->current_file_pos, zm->rxd_header_pos);
return FALSE;
}
......@@ -1523,7 +1523,7 @@ BOOL zmodem_handle_zrpos(zmodem_t* zm, uint64_t* pos)
BOOL zmodem_handle_zack(zmodem_t* zm, uint32_t min, uint32_t max)
{
if(zm->rxd_header_pos >= min && zm->rxd_header_pos <= max) {
lprintf(zm, LOG_DEBUG, "%lu Received valid ZACK", zm->rxd_header_pos);
lprintf(zm, LOG_DEBUG, "%lu Received valid ZACK", (ulong)zm->rxd_header_pos);
zm->ack_file_pos = zm->rxd_header_pos;
return TRUE;
}
......@@ -1661,7 +1661,7 @@ int zmodem_send_from(zmodem_t* zm, FILE* fp, uint64_t pos, uint64_t* sent)
}
}
lprintf(zm, LOG_DEBUG, "%lu Sending %s data subpacket (%u bytes) window: %lu / %lu"
lprintf(zm, LOG_DEBUG, "%lu Sending %s data subpacket (%lu bytes) window: %lu / %lu"
,(ulong)pos, chr(tx_type), len, (ulong)zm->current_window_size, (ulong)zm->max_window_size);
if(zmodem_send_data(zm, tx_type, zm->tx_data_subpacket, len) != SEND_SUCCESS) {
zm->consecutive_errors++;
......@@ -1896,7 +1896,7 @@ BOOL zmodem_send_file(zmodem_t* zm, char* fname, FILE* fp, BOOL request_init, ti
if(zm->crc_request==0)
lprintf(zm,LOG_NOTICE,"Receiver requested CRC of entire file");
else
lprintf(zm,LOG_NOTICE,"Receiver requested CRC of first %lu bytes of file"
lprintf(zm,LOG_NOTICE,"Receiver requested CRC of first %u bytes of file"
,zm->crc_request);
zmodem_send_pos_header(zm, ZCRC, fcrc32(fp,zm->crc_request), /* Hex: */TRUE);
type = zmodem_recv_header(zm);
......@@ -2054,7 +2054,7 @@ int zmodem_recv_files(zmodem_t* zm, const char* download_dir, uint64_t* bytes_re
lprintf(zm,LOG_NOTICE,"Calculating CRC of: %s", fpath);
crc=fcrc32(fp,(uint32_t)l); /* Warning: 4GB limit! */
fclose(fp);
lprintf(zm,LOG_INFO,"CRC of %s (%lu bytes): %08lX"
lprintf(zm,LOG_INFO,"CRC of %s (%lu bytes): %08X"
,getfname(fpath), (ulong)l, crc);
lprintf(zm,LOG_NOTICE,"Waiting for CRC of remote file: %s", zm->current_file_name);
if(!zmodem_recv_crc(zm,&rcrc)) {
......@@ -2062,7 +2062,7 @@ int zmodem_recv_files(zmodem_t* zm, const char* download_dir, uint64_t* bytes_re
break;
}
if(crc!=rcrc) {
lprintf(zm,LOG_WARNING,"Remote file has different CRC value: %08lX", rcrc);
lprintf(zm,LOG_WARNING,"Remote file has different CRC value: %08X", rcrc);
if(zm->duplicate_filename) {
if(zm->duplicate_filename(zm->cbdata, zm)) {
loop=TRUE;
......@@ -2293,7 +2293,7 @@ unsigned zmodem_recv_file_data(zmodem_t* zm, FILE* fp, int64_t offset)
errors++;
lprintf(zm, LOG_WARNING, "%lu ERROR #%d: %s (type: %s)", (ulong)pos, errors, chr(result), chr(type));
if(errors > zm->max_errors) {
lprintf(zm, LOG_ERR, "%lu Maximum errors (%lu) exceeded", (ulong)pos, zm->max_errors);
lprintf(zm, LOG_ERR, "%lu Maximum errors (%u) exceeded", (ulong)pos, zm->max_errors);
break;
}
if(zmodem_waits_for_ack(type))
......@@ -2328,7 +2328,7 @@ int zmodem_recv_file_frame(zmodem_t* zm, FILE* fp, int* type)
*/
if(zm->rxd_header_pos==(uint32_t)ftello(fp))
return result;
lprintf(zm,LOG_WARNING,"Ignoring ZEOF as all bytes (%lu) have not been received"
lprintf(zm,LOG_WARNING,"Ignoring ZEOF as all bytes (%u) have not been received"
,zm->rxd_header_pos);
continue;
case ZFIN:
......
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