...
 
Commits (3)
......@@ -1082,7 +1082,8 @@ void sbbs_t::privchat(bool forced, int node_num)
lseek(in,0L,SEEK_SET);
ch=0;
utime(inpath,NULL);
(void)read(in,&ch,1);
if(read(in,&ch,1) != 1)
ch = 0;
(void)lseek(in,-1L,SEEK_CUR);
if(!ch) break; /* char from other node */
activity=1;
......
......@@ -1404,7 +1404,7 @@ void sbbs_t::progress(const char* text, int count, int total, int interval)
if((count%interval) != 0)
return;
if(text == NULL) text = "";
float pct = ((float)count/total)*100.0F;
float pct = total ? ((float)count/total)*100.0F : 100.0F;
SAFEPRINTF2(str, "[ %-8s %4.1f%% ]", text, pct);
cursor_left(backfill(str, pct, cfg.color[clr_progress_full], cfg.color[clr_progress_empty]));
}
......
/* js_com.c */
/* Synchronet JavaScript "COM" Object */
/* $Id: js_com.c,v 1.33 2020/04/20 01:47:45 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. *
****************************************************************************/
......@@ -169,7 +153,7 @@ js_send(JSContext *cx, uintN argc, jsval *arglist)
JSObject *obj=JS_THIS_OBJECT(cx, arglist);
jsval *argv=JS_ARGV(cx, arglist);
char* cp = NULL;
size_t len;
size_t len = 0;
private_t* p;
jsrefcount rc;
......@@ -578,12 +562,13 @@ static JSBool js_com_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict, j
p->last_error=i;
break;
case COM_PROP_BAUD_RATE:
JS_ValueToNumber(cx,*vp,&d);
p->baud_rate=(long)d;
rc=JS_SUSPENDREQUEST(cx);
if(p->is_open)
comSetBaudRate(p->com, p->baud_rate);
JS_RESUMEREQUEST(cx, rc);
if(JS_ValueToNumber(cx,*vp,&d)) {
p->baud_rate=(long)d;
rc=JS_SUSPENDREQUEST(cx);
if(p->is_open)
comSetBaudRate(p->com, p->baud_rate);
JS_RESUMEREQUEST(cx, rc);
}
break;
case COM_PROP_NETWORK_ORDER:
JS_ValueToBoolean(cx,*vp,&(p->network_byte_order));
......
......@@ -1761,11 +1761,11 @@ js_gotoxy(JSContext *cx, uintN argc, jsval *arglist)
JS_SET_RVAL(cx, arglist, JSVAL_VOID);
if(JSVAL_IS_OBJECT(argv[0])) {
JS_GetProperty(cx, JSVAL_TO_OBJECT(argv[0]),"x", &val);
if(!JS_ValueToInt32(cx,val,&x))
if(!JS_GetProperty(cx, JSVAL_TO_OBJECT(argv[0]),"x", &val)
|| !JS_ValueToInt32(cx,val,&x))
return JS_FALSE;
JS_GetProperty(cx, JSVAL_TO_OBJECT(argv[0]),"y", &val);
if(!JS_ValueToInt32(cx,val,&y))
if(!JS_GetProperty(cx, JSVAL_TO_OBJECT(argv[0]),"y", &val)
|| !JS_ValueToInt32(cx,val,&y))
return JS_FALSE;
} else {
if((!JS_ValueToInt32(cx,argv[0],&x)) ||
......
......@@ -1533,7 +1533,10 @@ js_iniSetAllObjects(JSContext *cx, uintN argc, jsval *arglist)
continue;
}
/* value */
JS_GetProperty(cx,object,cp,&set_argv[2]);
if(!JS_GetProperty(cx,object,cp,&set_argv[2])) {
FREE_AND_NULL(cp);
continue;
}
FREE_AND_NULL(cp); /* Moved from before JS_GetProperty() call */
if(!js_iniSetValue_internal(cx,obj,3,set_argv,&list)) {
rval = JSVAL_FALSE;
......
......@@ -4194,12 +4194,13 @@ js_flags_str(JSContext *cx, uintN argc, jsval *arglist)
}
/* number to string */
JS_ValueToNumber(cx,argv[0],&d);
if(JS_ValueToNumber(cx,argv[0],&d)) {
if((js_str = JS_NewStringCopyZ(cx, ltoaf((long)d,str)))==NULL)
return(JS_FALSE);
if((js_str = JS_NewStringCopyZ(cx, ltoaf((long)d,str)))==NULL)
return(JS_FALSE);
JS_SET_RVAL(cx, arglist, STRING_TO_JSVAL(js_str));
JS_SET_RVAL(cx, arglist, STRING_TO_JSVAL(js_str));
}
return(JS_TRUE);
}
......
......@@ -554,9 +554,10 @@ void DLLCALL js_timeval(JSContext* cx, jsval val, struct timeval* tv)
if(JSVAL_IS_INT(val))
tv->tv_sec = JSVAL_TO_INT(val);
else if(JSVAL_IS_DOUBLE(val)) {
JS_ValueToNumber(cx,val,&jsd);
tv->tv_sec = (int)jsd;
tv->tv_usec = (int)(jsd*1000000.0)%1000000;
if(JS_ValueToNumber(cx,val,&jsd)) {
tv->tv_sec = (int)jsd;
tv->tv_usec = (int)(jsd*1000000.0)%1000000;
}
}
}
......@@ -840,7 +841,7 @@ js_send(JSContext *cx, uintN argc, jsval *arglist)
rc=JS_SUSPENDREQUEST(cx);
ret = js_socket_sendsocket(p,cp,len,TRUE);
if(ret >= 0) {
dbprintf(FALSE, p, "sent %d of %u bytes",ret,len);
dbprintf(FALSE, p, "sent %d of %lu bytes",ret,len);
JS_SET_RVAL(cx, arglist, INT_TO_JSVAL(ret));
} else {
p->last_error=ERROR_VALUE;
......
......@@ -1106,7 +1106,8 @@ js_timestr(JSContext *cx, uintN argc, jsval *arglist)
if(argc<1)
ti=(jsdouble)time(NULL); /* use current time */
else
JS_ValueToNumber(cx,argv[0],&ti);
if(!JS_ValueToNumber(cx,argv[0],&ti))
return JS_TRUE;
rc=JS_SUSPENDREQUEST(cx);
timestr(sys->cfg,(time32_t)ti,str);
JS_RESUMEREQUEST(cx, rc);
......@@ -1440,8 +1441,10 @@ js_get_node(JSContext *cx, uintN argc, jsval *arglist)
scfg_t* cfg = sys->cfg;
node_num=cfg->node_num;
if(argc)
JS_ValueToInt32(cx,argv[0],&node_num);
if(argc) {
if(!JS_ValueToInt32(cx,argv[0],&node_num))
return JS_TRUE;
}
if(node_num<1)
node_num=1;
......@@ -1732,8 +1735,7 @@ js_new_user(JSContext *cx, uintN argc, jsval *arglist)
if(client!=NULL) {
if(client->protocol != NULL)
SAFECOPY(user.modem,client->protocol);
if(client->host != NULL)
SAFECOPY(user.comp,client->host);
SAFECOPY(user.comp,client->host);
if(client->addr != NULL)
SAFECOPY(user.ipaddr,client->addr);
}
......
......@@ -416,7 +416,7 @@ char* DLLCALL prep_dir(const char* base, char* path, size_t buflen)
else
SAFEPRINTF3(str,"%s%c%s",base,PATH_DELIM,path);
} else
strcpy(str,path);
SAFECOPY(str,path);
#ifdef __unix__ /* Change backslashes to forward slashes on Unix */
for(p=str;*p;p++)
......@@ -425,7 +425,7 @@ char* DLLCALL prep_dir(const char* base, char* path, size_t buflen)
#endif
backslashcolon(str);
strcat(str,"."); /* Change C: to C:. and C:\SBBS\ to C:\SBBS\. */
SAFECAT(str,"."); /* Change C: to C:. and C:\SBBS\ to C:\SBBS\. */
FULLPATH(abspath,str,buflen); /* Change C:\SBBS\NODE1\..\EXEC to C:\SBBS\EXEC */
backslash(abspath);
......
......@@ -2631,7 +2631,7 @@ static int chk_received_hdr(SOCKET socket,const char* prot,const char *buf,IN_AD
{
char host_name[128];
char *fromstr;
char ip[16];
char ip[16] = "ipv6-addr";
char *p;
char *p2;
char *last;
......
......@@ -3317,7 +3317,7 @@ sbbs_t::sbbs_t(ushort node_num, union xp_sockaddr *addr, size_t addr_len, const
SAFECOPY(cfg.node_dir, cfg.node_path[node_num-1]);
prep_dir(cfg.node_dir, cfg.temp_dir, sizeof(cfg.temp_dir));
SAFEPRINTF2(syspage_semfile, "%ssyspage.%u", cfg.ctrl_dir, node_num);
remove(syspage_semfile);
(void)remove(syspage_semfile);
} else { /* event thread needs exclusive-use temp_dir */
if(startup->temp_dir[0])
SAFECOPY(cfg.temp_dir,startup->temp_dir);
......@@ -4077,7 +4077,7 @@ void sbbs_t::spymsg(const char* msg)
/****************************************************************************/
int sbbs_t::mv(char *src, char *dest, char copy)
{
char str[MAX_PATH+1],*buf,atr=curatr;
char *buf,atr=curatr;
int ind,outd;
uint chunk=MV_BUFLEN;
ulong length,l;
......@@ -4114,7 +4114,7 @@ int sbbs_t::mv(char *src, char *dest, char copy)
}
if((inp=fdopen(ind,"rb"))==NULL) {
close(ind);
errormsg(WHERE,ERR_FDOPEN,str,O_RDONLY);
errormsg(WHERE,ERR_FDOPEN,src,O_RDONLY);
return(-1);
}
setvbuf(inp,NULL,_IOFBF,32*1024);
......@@ -4391,7 +4391,7 @@ void sbbs_t::reset_logon_vars(void)
/****************************************************************************/
void sbbs_t::catsyslog(int crash)
{
char str[MAX_PATH+1];
char str[MAX_PATH+1] = "node.log";
char *buf;
int i,file;
long length;
......
......@@ -46,7 +46,7 @@ bool sbbs_t::printfile(const char* fname, long mode, long org_cols, JSObject* ob
FILE *stream;
SAFECOPY(fpath, fname);
fexistcase(fpath);
(void)fexistcase(fpath);
p=getfext(fpath);
if(p!=NULL) {
if(stricmp(p,".rip")==0) {
......@@ -171,7 +171,7 @@ bool sbbs_t::printtail(const char* fname, int lines, long mode, long org_cols, J
long length,l;
SAFECOPY(fpath, fname);
fexistcase(fpath);
(void)fexistcase(fpath);
if(mode&P_NOABORT) {
if(online==ON_REMOTE) {
rioctl(IOCM|ABORT);
......
......@@ -481,8 +481,8 @@ void status_thread(void *arg)
pthread_once(&init_once, init_lists);
startup->status(startup->cbdata, "Initializing");
strcpy(client.addr, startup->sock_fname);
strcpy(client.host, "<unix-domain>");
SAFECOPY(client.addr, startup->sock_fname);
SAFECOPY(client.host, "<unix-domain>");
client.protocol = "STATUS";
client.size = sizeof(client);
......
This diff is collapsed.
/* Synchronet file database scanning routines */
/* $Id: scandirs.cpp,v 1.8 2018/10/22 04:18:06 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -15,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. *
****************************************************************************/
......@@ -40,7 +26,7 @@
/****************************************************************************/
void sbbs_t::scandirs(long mode)
{
char ch,str[256];
char ch,str[256]="";
char tmp[512];
int s;
uint i,k;
......@@ -55,7 +41,6 @@ void sbbs_t::scandirs(long mode)
if(ch!='A') {
if(mode&FL_ULTIME) { /* New file scan */
bprintf(text[NScanHdr],timestr(ns_time));
str[0]=0;
}
else if(mode==FL_NO_HDR) { /* Search for a string */
if(!getfilespec(tmp))
......@@ -115,7 +100,7 @@ void sbbs_t::scandirs(long mode)
/****************************************************************************/
void sbbs_t::scanalldirs(long mode)
{
char str[256];
char str[256]="";
char tmp[512];
int s;
uint i,j,k,d;
......@@ -124,7 +109,6 @@ void sbbs_t::scanalldirs(long mode)
k=0;
if(mode&FL_ULTIME) { /* New file scan */
bprintf(text[NScanHdr],timestr(ns_time));
str[0]=0;
}
else if(mode==FL_NO_HDR) { /* Search for a string */
if(!getfilespec(tmp))
......
......@@ -1309,9 +1309,9 @@ void getar(char *desc, char *inar)
for(i=0;i<n;i++) {
for(j=0;j<7;j++)
if(!strnicmp(ar+i,wday[j],3)) {
strcat(str,ultoa(j,tmp,10));
SAFECAT(str,ultoa(j,tmp,10));
i+=2;
break;
break;
}
if(j==7)
strncat(str,ar+i,1);
......@@ -1440,7 +1440,6 @@ void getar(char *desc, char *inar)
if(ar[i]!=' ' && ar[i]!='&')
strncat(str,ar+i,1);
SAFECOPY(ar,str);
len=strlen(ar);
}
i=0;
sprintf(opt[i++],"Requirement String (%s)",ar);
......@@ -2180,7 +2179,7 @@ void bail(int code)
{
if(code) {
printf("\nHit enter to continue...");
getchar();
(void)getchar();
}
else if(forcesave) {
load_main_cfg(&cfg, error, sizeof(error));
......@@ -2219,7 +2218,7 @@ void errormsg(int line, const char* function, const char *source, const char* ac
printf(" object: %s\n",object);
printf(" access: %ld (%lx)\n",access,access);
printf("\nHit enter to continue...");
getchar();
(void)getchar();
puttext(1,1,80,uifc.scrn_len,scrn_buf);
}
......
......@@ -51,9 +51,9 @@ bool new_qhub(unsigned new_qhubnum)
bool new_qhub_sub(qhub_t* qhub, unsigned subnum, sub_t* sub, unsigned confnum)
{
if((qhub->sub=realloc(qhub->sub, sizeof(sub_t *)*(qhub->subs+1)))==NULL
|| (qhub->conf=(ushort *)realloc(qhub->conf, sizeof(ushort *)*(qhub->subs+1)))==NULL
|| (qhub->mode=(char *)realloc(qhub->mode, sizeof(uchar *)*(qhub->subs+1)))==NULL) {
if((qhub->sub=realloc(qhub->sub, sizeof(*qhub->sub)*(qhub->subs+1)))==NULL
|| (qhub->conf=(ushort *)realloc(qhub->conf, sizeof(*qhub->conf)*(qhub->subs+1)))==NULL
|| (qhub->mode=(char *)realloc(qhub->mode, sizeof(*qhub->mode)*(qhub->subs+1)))==NULL) {
/* ToDo: report error */
return false;
}
......@@ -135,7 +135,7 @@ uint getsub(void)
opt[k][0]=0;
sprintf(str,"Select %s Sub-board",cfg.grp[i]->sname);
j=uifc.list(WIN_RHT|WIN_BOT|WIN_SAV,0,0,45,&sub_dflt,&sub_bar,str,opt);
if(j==-1 || j >= k)
if(j==-1 || j >= cfg.total_subs)
continue;
sub_dflt++;
sub_bar++;
......@@ -1292,7 +1292,7 @@ BOOL import_qwk_conferences(uint qhubnum)
if(uifc.input(WIN_MID|WIN_SAV,0,0,"Filename"
,filename,sizeof(filename)-1,K_EDIT)<=0)
return FALSE;
fexistcase(filename);
(void)fexistcase(filename);
FILE *fp;
if((fp = fopen(filename, "rt"))==NULL) {
uifc.msg("File Open Failure");
......@@ -1329,7 +1329,7 @@ char *daystr(char days)
for(i=0;i<7;i++) {
if(days&(1<<i)) {
strcat(str,wday[i]);
strcat(str," ");
SAFECAT(str," ");
}
}
return(str);
......
......@@ -165,7 +165,7 @@ static char* monthstr(uint16_t months)
continue;
if(str[0])
strcat(str," ");
strcat(str,mon[i]);
SAFECAT(str,mon[i]);
}
return(str);
......
......@@ -444,7 +444,9 @@ js_login(JSContext *cx, uintN argc, jsval *arglist)
,client->socket,client->service->protocol,client->user.alias);
val = BOOLEAN_TO_JSVAL(JS_TRUE);
JS_SetProperty(cx, obj, "logged_in", &val);
if(!JS_SetProperty(cx, obj, "logged_in", &val))
llprintf(LOG_ERR, "%04d %s Error setting logged in property for %s"
,client->socket, client->service->protocol, client->user.alias);
if(client->user.pass[0])
loginSuccess(startup->login_attempt_list, &client->addr);
......@@ -617,6 +619,8 @@ js_client_add(JSContext *cx, uintN argc, jsval *arglist)
SAFECOPY(client.host,client.user);
sock=js_socket(cx,argv[0]);
if(sock < 0)
return JS_TRUE;
addr_len = sizeof(addr);
if(getpeername(sock, &addr.addr, &addr_len)==0) {
......@@ -670,6 +674,8 @@ js_client_update(JSContext *cx, uintN argc, jsval *arglist)
SAFECOPY(client.host,client.user);
sock=js_socket(cx,argv[0]);
if(sock < 0)
return JS_TRUE;
addr_len = sizeof(addr);
if(getpeername(sock, &addr.addr, &addr_len)==0) {
......@@ -713,6 +719,8 @@ js_client_remove(JSContext *cx, uintN argc, jsval *arglist)
return(JS_FALSE);
sock=js_socket(cx,argv[0]);
if(sock < 0)
return JS_TRUE;
if(sock!=INVALID_SOCKET) {
......@@ -1325,6 +1333,14 @@ static void native_static_service_thread(void* arg)
}
#else
socket_dup = dup(inst.socket);
if(socket_dup == -1) {
lprintf(LOG_ERR,"%04d %s !ERROR %d duplicating socket descriptor"
,inst.socket, inst.service->protocol, errno);
close_socket(inst.socket);
thread_down();
inst.service->running--;
return;
}
#endif
/* RUN SCRIPT */
......@@ -1440,6 +1456,13 @@ static void native_service_thread(void* arg)
}
#else
socket_dup = dup(socket);
if(socket_dup == -1) {
lprintf(LOG_ERR,"%04d %s !ERROR %d duplicating socket descriptor"
,socket, service->protocol, errno);
close_socket(socket);
thread_down();
return;
}
#endif
update_clients();
......
......@@ -722,7 +722,7 @@ static void output_thread(void* arg)
dump(buf+bufbot,i);
if(i!=(int)(buftop-bufbot)) {
lprintf(LOG_ERR,"Short socket send (%u instead of %u)"
lprintf(LOG_ERR,"Short socket send (%u instead of %lu)"
,i ,buftop-bufbot);
short_sends++;
}
......@@ -938,7 +938,7 @@ static int send_files(char** fname, uint fnames)
return(-1);
}
if(xm.total_files>1)
lprintf(LOG_INFO,"Sending %u files (%"PRId64" KB total)"
lprintf(LOG_INFO,"Sending %lu files (%"PRId64" KB total)"
,xm.total_files,xm.total_bytes/1024);
zm.files_remaining = xm.total_files;
......@@ -989,11 +989,11 @@ static int send_files(char** fname, uint fnames)
if(zm.file_skipped)
lprintf(LOG_WARNING,"File Skipped");
else
lprintf(LOG_INFO,"Successful - Time: %lu:%02lu CPS: %lu"
lprintf(LOG_INFO,"Successful - Time: %lu:%02lu CPS: %u"
,t/60,t%60,cps);
if(xm.total_files-xm.sent_files)
lprintf(LOG_INFO,"Remaining - Time: %lu:%02lu Files: %u KBytes: %"PRId64
lprintf(LOG_INFO,"Remaining - Time: %lu:%02lu Files: %lu KBytes: %"PRId64
,((xm.total_bytes-xm.sent_bytes)/cps)/60
,((xm.total_bytes-xm.sent_bytes)/cps)%60
,xm.total_files-xm.sent_files
......
......@@ -142,7 +142,7 @@ int main(int argc, char **argv)
lprintf("\nComparing user pointers ");
for(glp=0; glp<gl.gl_pathc; glp++) {
lprintf("%-5d\b\b\b\b\b",glp);
lprintf("%-5ld\b\b\b\b\b",glp);
SAFECOPY(str,gl.gl_pathv[glp]);
if((file=nopen(str,O_RDONLY|O_BINARY))==-1) {
continue; }
......
......@@ -2269,6 +2269,9 @@ int putuserrec(scfg_t* cfg, int usernumber,int start, uint length, const char *s
if(!VALID_CFG(cfg) || usernumber<1 || str==NULL)
return(-1);
if(length > sizeof(str2) - 1)
return -10;
SAFEPRINTF(str2,"%suser/user.dat",cfg->data_dir);
if((file=nopen(str2,O_RDWR|O_DENYNONE))==-1)
return(errno);
......@@ -2286,7 +2289,7 @@ int putuserrec(scfg_t* cfg, int usernumber,int start, uint length, const char *s
}
}
strcpy(str2,str);
SAFECOPY(str2,str);
if(strlen(str2)<length) {
for(c=strlen(str2);c<length;c++)
str2[c]=ETX;
......
......@@ -3583,7 +3583,7 @@ static BOOL check_request(http_session_t * session)
last_slash=path;
else
last_slash++;
strcpy(filename,last_slash);
SAFECOPY(filename,last_slash);
}
if(strnicmp(path,root_dir,strlen(root_dir))) {
......@@ -4795,7 +4795,9 @@ static BOOL exec_cgi(http_session_t *session)
if((p=strrchr(cgipath,'/'))!=NULL)
{
*p=0;
chdir(cgipath);
if(chdir(cgipath) != 0)
lprintf(LOG_ERR, "%04d !ERROR %d changing directory to %s"
,session->socket, errno, cgipath);
}
/* Execute command */
......@@ -5861,21 +5863,20 @@ static BOOL ssjs_send_headers(http_session_t* session,int chunked)
size_t p_sz=0, p2_sz=0;
JS_BEGINREQUEST(session->js_cx);
if(JS_GetProperty(session->js_cx,session->js_glob,"http_reply",&val))
if(JS_GetProperty(session->js_cx,session->js_glob,"http_reply",&val)) {
reply = JSVAL_TO_OBJECT(val);
if(JS_GetProperty(session->js_cx,reply,"status",&val))
JSVALUE_TO_STRBUF(session->js_cx, val, session->req.status, sizeof(session->req.status), NULL);
if(JS_GetProperty(session->js_cx,reply,"header",&val)) {
headers = JSVAL_TO_OBJECT(val);
heads=JS_Enumerate(session->js_cx,headers);
if(JS_GetProperty(session->js_cx,reply,"status",&val))
JSVALUE_TO_STRBUF(session->js_cx, val, session->req.status, sizeof(session->req.status), NULL);
if(JS_GetProperty(session->js_cx,reply,"header",&val)) {
headers = JSVAL_TO_OBJECT(val);
heads=JS_Enumerate(session->js_cx,headers);
}
}
if(heads != NULL) {
for(i=0;i<heads->length;i++) {
JS_IdToValue(session->js_cx,heads->vector[i],&val);
JSVALUE_TO_RASTRING(session->js_cx, val, p, &p_sz, NULL);
if(p==NULL) {
if(p)
free(p);
if(p2)
free(p2);
return FALSE;
......@@ -5889,7 +5890,7 @@ static BOOL ssjs_send_headers(http_session_t* session,int chunked)
free(p2);
return FALSE;
}
if (!session->req.sent_headers) {
if (p2 != NULL && !session->req.sent_headers) {
h = get_header_type(p);
switch(h) {
case HEAD_LOCATION:
......
......@@ -1436,7 +1436,11 @@ int sbbs_t::external(const char* cmdline, long mode, const char* startup_dir)
sprintf(str, "%s/.dosemu", cfg.ctrl_dir);
if (!isdir(str)) {
mkdir(str, 0755);
if(mkdir(str, 0755) != 0) {
errormsg(WHERE,ERR_MKDIR, str, 0755);
fclose(dosemubatfp);
return -1;
}
}
strcat(str, "/disclaimer");
ftouch(str);
......
......@@ -1527,7 +1527,7 @@ BOOL zmodem_handle_zack(zmodem_t* zm, uint32_t min, uint32_t max)
zm->ack_file_pos = zm->rxd_header_pos;
return TRUE;
}
lprintf(zm, LOG_WARNING, "%lu Received INVALID ZACK, offset: %lu"
lprintf(zm, LOG_WARNING, "%lu Received INVALID ZACK, offset: %u"
, (ulong)zm->current_file_pos, zm->rxd_header_pos);
return FALSE;
}
......
......@@ -1934,13 +1934,13 @@ int SMBCALL smb_create(smb_t* smb)
fclose(fp);
}
SAFEPRINTF(str,"%s.sda",smb->file);
remove(str); /* if it exists, delete it */
(void)remove(str); /* if it exists, delete it */
SAFEPRINTF(str,"%s.sha",smb->file);
remove(str); /* if it exists, delete it */
(void)remove(str); /* if it exists, delete it */
SAFEPRINTF(str,"%s.sch",smb->file);
remove(str);
(void)remove(str);
SAFEPRINTF(str,"%s.hash",smb->file);
remove(str);
(void)remove(str);
smb_unlocksmbhdr(smb);
return(SMB_SUCCESS);
}
......