Commit 5ecf1f48 authored by rswindell's avatar rswindell
Browse files

Switched from std C time functions (gmtime, localtime, and ctime) to reentrant

variants (gmtime_r, localtime_r, and ctime_r) for thread-safe operation on Unix
parent d804c2b2
...@@ -44,7 +44,7 @@ bool sbbs_t::answer() ...@@ -44,7 +44,7 @@ bool sbbs_t::answer()
char tmp[MAX_PATH+1]; char tmp[MAX_PATH+1];
char tmp2[MAX_PATH+1]; char tmp2[MAX_PATH+1];
int i,l,in; int i,l,in;
struct tm * tm; struct tm tm;
struct in_addr addr; struct in_addr addr;
useron.number=0; useron.number=0;
...@@ -52,15 +52,14 @@ bool sbbs_t::answer() ...@@ -52,15 +52,14 @@ bool sbbs_t::answer()
/* Caller ID is IP address */ /* Caller ID is IP address */
addr.s_addr=client_addr; addr.s_addr=client_addr;
strcpy(cid,inet_ntoa(addr)); strcpy(cid,inet_ntoa(addr));
tm=localtime(&now); memset(&tm,0,sizeof(tm));
if(tm==NULL) localtime_r(&now,&tm);
return(false);
sprintf(str,"%s %s %s %02d %u Node %3u" sprintf(str,"%s %s %s %02d %u Node %3u"
,hhmmtostr(&cfg,tm,str2) ,hhmmtostr(&cfg,&tm,str2)
,wday[tm->tm_wday] ,wday[tm.tm_wday]
,mon[tm->tm_mon],tm->tm_mday,tm->tm_year+1900,cfg.node_num); ,mon[tm.tm_mon],tm.tm_mday,tm.tm_year+1900,cfg.node_num);
logline("@ ",str); logline("@ ",str);
sprintf(str,"%s %s [%s]", connection, client_name, cid); sprintf(str,"%s %s [%s]", connection, client_name, cid);
......
...@@ -92,7 +92,6 @@ char* sbbs_t::atcode(char* sp, char* str) ...@@ -92,7 +92,6 @@ char* sbbs_t::atcode(char* sp, char* str)
stats_t stats; stats_t stats;
node_t node; node_t node;
struct tm tm; struct tm tm;
struct tm * tm_p;
str[0]=0; str[0]=0;
...@@ -209,11 +208,7 @@ char* sbbs_t::atcode(char* sp, char* str) ...@@ -209,11 +208,7 @@ char* sbbs_t::atcode(char* sp, char* str)
if(!strcmp(sp,"TIME") || !strcmp(sp,"SYSTIME")) { if(!strcmp(sp,"TIME") || !strcmp(sp,"SYSTIME")) {
now=time(NULL); now=time(NULL);
tm_p=localtime(&now); memset(&tm,0,sizeof(tm));
if(tm_p!=NULL)
tm=*tm_p;
else
memset(&tm,0,sizeof(tm));
sprintf(str,"%02d:%02d %s" sprintf(str,"%02d:%02d %s"
,tm.tm_hour==0 ? 12 ,tm.tm_hour==0 ? 12
: tm.tm_hour>12 ? tm.tm_hour-12 : tm.tm_hour>12 ? tm.tm_hour-12
...@@ -426,11 +421,8 @@ char* sbbs_t::atcode(char* sp, char* str) ...@@ -426,11 +421,8 @@ char* sbbs_t::atcode(char* sp, char* str)
return(unixtodstr(&cfg,useron.laston,str)); return(unixtodstr(&cfg,useron.laston,str));
if(!strcmp(sp,"LASTTIMEON")) { if(!strcmp(sp,"LASTTIMEON")) {
tm_p=localtime(&useron.laston); memset(&tm,0,sizeof(tm));
if(tm_p) localtime_r(&useron.laston,&tm);
tm=*tm_p;
else
memset(&tm,0,sizeof(tm));
sprintf(str,"%02d:%02d %s" sprintf(str,"%02d:%02d %s"
,tm.tm_hour==0 ? 12 ,tm.tm_hour==0 ? 12
: tm.tm_hour>12 ? tm.tm_hour-12 : tm.tm_hour>12 ? tm.tm_hour-12
......
...@@ -347,7 +347,7 @@ void sbbs_t::start_batch_download() ...@@ -347,7 +347,7 @@ void sbbs_t::start_batch_download()
uint i,xfrprot; uint i,xfrprot;
ulong totalcdt,totalsize,totaltime; ulong totalcdt,totalsize,totaltime;
time_t start,end,t; time_t start,end,t;
struct tm * tm; struct tm tm;
if(useron.rest&FLAG('D')) { /* Download restriction */ if(useron.rest&FLAG('D')) { /* Download restriction */
bputs(text[R_Download]); bputs(text[R_Download]);
...@@ -454,10 +454,8 @@ void sbbs_t::start_batch_download() ...@@ -454,10 +454,8 @@ void sbbs_t::start_batch_download()
t=now; t=now;
if(cur_cps) if(cur_cps)
t+=(totalsize/(ulong)cur_cps); t+=(totalsize/(ulong)cur_cps);
tm=localtime(&t); localtime_r(&t,&tm);
if(tm==NULL) thisnode.aux=(tm.tm_hour*60)+tm.tm_min;
return;
thisnode.aux=(tm->tm_hour*60)+tm->tm_min;
thisnode.action=action; thisnode.action=action;
putnodedat(cfg.node_num,&thisnode); /* calculate ETA */ putnodedat(cfg.node_num,&thisnode); /* calculate ETA */
start=time(NULL); start=time(NULL);
......
...@@ -1381,15 +1381,10 @@ void sbbs_t::guruchat(char *line, char *gurubuf, int gurunum) ...@@ -1381,15 +1381,10 @@ void sbbs_t::guruchat(char *line, char *gurubuf, int gurunum)
int file; int file;
uint c,i,j,k; uint c,i,j,k;
long len; long len;
struct tm *tm_p;
struct tm tm; struct tm tm;
now=time(NULL); now=time(NULL);
tm_p=localtime(&now); localtime_r(&now,&tm);
if(tm_p)
tm=*tm_p;
else
memset(&tm,0,sizeof(tm));
for(i=0;i<100;i++) { for(i=0;i<100;i++) {
if((answer[i]=(char *)MALLOC(513))==NULL) { if((answer[i]=(char *)MALLOC(513))==NULL) {
......
...@@ -42,7 +42,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user) ...@@ -42,7 +42,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user)
bool result,_not,_or,equal; bool result,_not,_or,equal;
uint i,n,artype,age; uint i,n,artype,age;
ulong l; ulong l;
struct tm * tm; struct tm tm;
result = true; result = true;
...@@ -203,9 +203,9 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user) ...@@ -203,9 +203,9 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user)
break; break;
case AR_DAY: case AR_DAY:
now=time(NULL); now=time(NULL);
tm=localtime(&now); localtime_r(&now,&tm);
if(tm==NULL || (equal && tm->tm_wday!=(int)n) if((equal && tm.tm_wday!=(int)n)
|| (!equal && tm->tm_wday<(int)n)) || (!equal && tm.tm_wday<(int)n))
result=_not; result=_not;
else else
result=!_not; result=!_not;
...@@ -382,8 +382,8 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user) ...@@ -382,8 +382,8 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user)
break; break;
case AR_TIME: case AR_TIME:
now=time(NULL); now=time(NULL);
tm=localtime(&now); localtime_r(&now,&tm);
if(tm==NULL || (tm->tm_hour*60)+tm->tm_min<(int)i) if((tm.tm_hour*60)+tm.tm_min<(int)i)
result=_not; result=_not;
else else
result=!_not; result=!_not;
......
...@@ -267,7 +267,7 @@ void sbbs_t::ctrl_a(char x) ...@@ -267,7 +267,7 @@ void sbbs_t::ctrl_a(char x)
{ {
int i; int i;
char tmp1[128],atr=curatr; char tmp1[128],atr=curatr;
struct tm * tm; struct tm tm;
if(x && (uchar)x<ESC) { /* Ctrl-A through Ctrl-Z for users with MF only */ if(x && (uchar)x<ESC) { /* Ctrl-A through Ctrl-Z for users with MF only */
if(!(useron.flags1&FLAG(x+64))) if(!(useron.flags1&FLAG(x+64)))
...@@ -336,12 +336,11 @@ void sbbs_t::ctrl_a(char x) ...@@ -336,12 +336,11 @@ void sbbs_t::ctrl_a(char x)
break; break;
case 'T': /* Time */ case 'T': /* Time */
now=time(NULL); now=time(NULL);
tm=localtime(&now); localtime_r(&now,&tm);
if(tm!=NULL) bprintf("%02d:%02d %s"
bprintf("%02d:%02d %s" ,tm.tm_hour==0 ? 12
,tm->tm_hour==0 ? 12 : tm.tm_hour>12 ? tm.tm_hour-12
: tm->tm_hour>12 ? tm->tm_hour-12 : tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am");
: tm->tm_hour, tm->tm_min, tm->tm_hour>11 ? "pm":"am");
break; break;
case 'D': /* Date */ case 'D': /* Date */
now=time(NULL); now=time(NULL);
......
...@@ -168,13 +168,11 @@ void sbbs_t::gettimeleft(void) ...@@ -168,13 +168,11 @@ void sbbs_t::gettimeleft(void)
time_t eventtime=0; time_t eventtime=0;
time_t thisevent; time_t thisevent;
long tleft; long tleft;
struct tm *tm, last_tm; struct tm tm, last_tm;
now=time(NULL); now=time(NULL);
tm=localtime(&now); localtime_r(&now,&tm);
if(tm==NULL)
return;
if(useron.exempt&FLAG('T')) { /* Time online exemption */ if(useron.exempt&FLAG('T')) { /* Time online exemption */
timeleft=cfg.level_timepercall[useron.level]*60; timeleft=cfg.level_timepercall[useron.level]*60;
if(timeleft<10) /* never get below 10 for exempt users */ if(timeleft<10) /* never get below 10 for exempt users */
...@@ -199,22 +197,16 @@ void sbbs_t::gettimeleft(void) ...@@ -199,22 +197,16 @@ void sbbs_t::gettimeleft(void)
continue; continue;
if(!(cfg.event[i]->misc&EVENT_FORCE) if(!(cfg.event[i]->misc&EVENT_FORCE)
|| (!(cfg.event[i]->misc&EVENT_EXCL) && cfg.event[i]->node!=cfg.node_num) || (!(cfg.event[i]->misc&EVENT_EXCL) && cfg.event[i]->node!=cfg.node_num)
|| !(cfg.event[i]->days&(1<<tm->tm_wday))) || !(cfg.event[i]->days&(1<<tm.tm_wday)))
continue; continue;
tm=localtime(&cfg.event[i]->last); localtime_r(&cfg.event[i]->last,&last_tm);
if(tm) localtime_r(&now,&tm);
last_tm=*tm; tm.tm_hour=cfg.event[i]->time/60; /* hasn't run yet today */
else tm.tm_min=cfg.event[i]->time-(tm.tm_hour*60);
memset(&last_tm,0,sizeof(last_tm)); tm.tm_sec=0;
tm=localtime(&now); thisevent=mktime(&tm);
if(tm==NULL) if(tm.tm_mday==last_tm.tm_mday && tm.tm_mon==last_tm.tm_mon)
return;
tm->tm_hour=cfg.event[i]->time/60; /* hasn't run yet today */
tm->tm_min=cfg.event[i]->time-(tm->tm_hour*60);
tm->tm_sec=0;
thisevent=mktime(tm);
if(tm->tm_mday==last_tm.tm_mday && tm->tm_mon==last_tm.tm_mon)
thisevent+=24L*60L*60L; /* already ran today, so add 24hrs */ thisevent+=24L*60L*60L; /* already ran today, so add 24hrs */
if(!eventtime || thisevent<eventtime) if(!eventtime || thisevent<eventtime)
eventtime=thisevent; eventtime=thisevent;
......
...@@ -94,27 +94,26 @@ time_t DLLCALL dstrtounix(scfg_t* cfg, char *instr) ...@@ -94,27 +94,26 @@ time_t DLLCALL dstrtounix(scfg_t* cfg, char *instr)
/****************************************************************************/ /****************************************************************************/
char* DLLCALL unixtodstr(scfg_t* cfg, time_t unix_time, char *str) char* DLLCALL unixtodstr(scfg_t* cfg, time_t unix_time, char *str)
{ {
struct tm* tm; struct tm tm;
if(!unix_time) if(!unix_time)
strcpy(str,"00/00/00"); strcpy(str,"00/00/00");
else { else {
tm=localtime(&unix_time); if(localtime_r(&unix_time,&tm)==NULL) {
if(tm==NULL) {
strcpy(str,"00/00/00"); strcpy(str,"00/00/00");
return(str); return(str);
} }
if(tm->tm_mon>11) { /* DOS leap year bug */ if(tm.tm_mon>11) { /* DOS leap year bug */
tm->tm_mon=0; tm.tm_mon=0;
tm->tm_year++; } tm.tm_year++; }
if(tm->tm_mday>31) if(tm.tm_mday>31)
tm->tm_mday=1; tm.tm_mday=1;
if(cfg->sys_misc&SM_EURODATE) if(cfg->sys_misc&SM_EURODATE)
sprintf(str,"%02u/%02u/%02u",tm->tm_mday,tm->tm_mon+1 sprintf(str,"%02u/%02u/%02u",tm.tm_mday,tm.tm_mon+1
,TM_YEAR(tm->tm_year)); ,TM_YEAR(tm.tm_year));
else else
sprintf(str,"%02u/%02u/%02u",tm->tm_mon+1,tm->tm_mday sprintf(str,"%02u/%02u/%02u",tm.tm_mon+1,tm.tm_mday
,TM_YEAR(tm->tm_year)); } ,TM_YEAR(tm.tm_year)); }
return(str); return(str);
} }
...@@ -154,35 +153,34 @@ char* DLLCALL timestr(scfg_t* cfg, time_t *intime, char* str) ...@@ -154,35 +153,34 @@ char* DLLCALL timestr(scfg_t* cfg, time_t *intime, char* str)
{ {
char* mer; char* mer;
uchar hour; uchar hour;
struct tm* gm; struct tm tm;
gm=localtime(intime); if(localtime_r(intime,&tm)==NULL) {
if(gm==NULL) {
strcpy(str,"Invalid Time"); strcpy(str,"Invalid Time");
return(str); return(str);
} }
if(cfg->sys_misc&SM_MILITARY) { if(cfg->sys_misc&SM_MILITARY) {
sprintf(str,"%s %s %02u %4u %02u:%02u:%02u" sprintf(str,"%s %s %02u %4u %02u:%02u:%02u"
,wday[gm->tm_wday],mon[gm->tm_mon],gm->tm_mday,1900+gm->tm_year ,wday[tm.tm_wday],mon[tm.tm_mon],tm.tm_mday,1900+tm.tm_year
,gm->tm_hour,gm->tm_min,gm->tm_sec); ,tm.tm_hour,tm.tm_min,tm.tm_sec);
return(str); return(str);
} }
if(gm->tm_hour>=12) { if(tm.tm_hour>=12) {
if(gm->tm_hour==12) if(tm.tm_hour==12)
hour=12; hour=12;
else else
hour=gm->tm_hour-12; hour=tm.tm_hour-12;
mer="pm"; mer="pm";
} else { } else {
if(gm->tm_hour==0) if(tm.tm_hour==0)
hour=12; hour=12;
else else
hour=gm->tm_hour; hour=tm.tm_hour;
mer="am"; mer="am";
} }
sprintf(str,"%s %s %02u %4u %02u:%02u %s" sprintf(str,"%s %s %02u %4u %02u:%02u %s"
,wday[gm->tm_wday],mon[gm->tm_mon],gm->tm_mday,1900+gm->tm_year ,wday[tm.tm_wday],mon[tm.tm_mon],tm.tm_mday,1900+tm.tm_year
,hour,gm->tm_min,mer); ,hour,tm.tm_min,mer);
return(str); return(str);
} }
...@@ -350,13 +348,9 @@ char* DLLCALL zonestr(short zone) ...@@ -350,13 +348,9 @@ char* DLLCALL zonestr(short zone)
/****************************************************************************/ /****************************************************************************/
char* DLLCALL msgdate(when_t when, char* buf) char* DLLCALL msgdate(when_t when, char* buf)
{ {
struct tm tm; struct tm tm;
struct tm* tm_p;
tm_p=localtime((const time_t*)&when.time); if(localtime_r((const time_t*)&when.time,&tm)==NULL)
if(tm_p!=NULL)
tm=*tm_p;
else
memset(&tm,0,sizeof(tm)); memset(&tm,0,sizeof(tm));
sprintf(buf,"%s, %d %s %d %02d:%02d:%02d %s" sprintf(buf,"%s, %d %s %d %02d:%02d:%02d %s"
,wday[tm.tm_wday] ,wday[tm.tm_wday]
......
...@@ -47,7 +47,7 @@ int sbbs_t::exec_function(csi_t *csi) ...@@ -47,7 +47,7 @@ int sbbs_t::exec_function(csi_t *csi)
uint i,j,k; uint i,j,k;
long l; long l;
node_t node; node_t node;
struct tm * tm; struct tm tm;
switch(*(csi->ip++)) { switch(*(csi->ip++)) {
...@@ -239,22 +239,20 @@ int sbbs_t::exec_function(csi_t *csi) ...@@ -239,22 +239,20 @@ int sbbs_t::exec_function(csi_t *csi)
case CS_SYSTEM_LOG: /* System log */ case CS_SYSTEM_LOG: /* System log */
if(!chksyspass()) if(!chksyspass())
return(0); return(0);
tm=localtime(&now); if(localtime_r(&now,&tm)==NULL)
if(tm==NULL)
return(0); return(0);
sprintf(str,"%slogs/%2.2d%2.2d%2.2d.log", cfg.data_dir sprintf(str,"%slogs/%2.2d%2.2d%2.2d.log", cfg.data_dir
,tm->tm_mon+1,tm->tm_mday,TM_YEAR(tm->tm_year)); ,tm.tm_mon+1,tm.tm_mday,TM_YEAR(tm.tm_year));
printfile(str,0); printfile(str,0);
return(0); return(0);
case CS_SYSTEM_YLOG: /* Yesterday's log */ case CS_SYSTEM_YLOG: /* Yesterday's log */
if(!chksyspass()) if(!chksyspass())
return(0); return(0);
now-=(ulong)60L*24L*60L; now-=(ulong)60L*24L*60L;
tm=localtime(&now); if(localtime_r(&now,&tm)==NULL)
if(tm==NULL)
return(0); return(0);
sprintf(str,"%slogs/%2.2d%2.2d%2.2d.log",cfg.data_dir sprintf(str,"%slogs/%2.2d%2.2d%2.2d.log",cfg.data_dir
,tm->tm_mon+1,tm->tm_mday,TM_YEAR(tm->tm_year)); ,tm.tm_mon+1,tm.tm_mday,TM_YEAR(tm.tm_year));
printfile(str,0); printfile(str,0);
return(0); return(0);
case CS_SYSTEM_STATS: /* System Statistics */ case CS_SYSTEM_STATS: /* System Statistics */
......
...@@ -47,7 +47,7 @@ int sbbs_t::exec_misc(csi_t* csi, char *path) ...@@ -47,7 +47,7 @@ int sbbs_t::exec_misc(csi_t* csi, char *path)
void *vp; void *vp;
va_list arglist[64]; va_list arglist[64];
struct dirent *de; struct dirent *de;
struct tm *tm_p; struct tm tm;
switch(*(csi->ip++)) { switch(*(csi->ip++)) {
case CS_VAR_INSTRUCTION: case CS_VAR_INSTRUCTION:
...@@ -518,10 +518,11 @@ int sbbs_t::exec_misc(csi_t* csi, char *path) ...@@ -518,10 +518,11 @@ int sbbs_t::exec_misc(csi_t* csi, char *path)
lp=getintvar(csi,*(long *)csi->ip); lp=getintvar(csi,*(long *)csi->ip);
csi->ip+=4; csi->ip+=4;
if(pp && lp) { if(pp && lp) {
tm_p=localtime((time_t *)lp); if(localtime_r((time_t *)lp,&tm)!=NULL) {
if(tm_p) { strftime(buf,128,str,&tm);
strftime(buf,128,str,tm_p); *pp=copystrvar(csi,*pp,buf);
*pp=copystrvar(csi,*pp,buf); } } }
}
return(0); return(0);
case TIME_STR: case TIME_STR:
pp=getstrvar(csi,*(long *)csi->ip); pp=getstrvar(csi,*(long *)csi->ip);
......
...@@ -105,7 +105,7 @@ bool sbbs_t::netmail(char *into, char *title, long mode) ...@@ -105,7 +105,7 @@ bool sbbs_t::netmail(char *into, char *title, long mode)
long length,l; long length,l;
faddr_t addr; faddr_t addr;
fmsghdr_t hdr; fmsghdr_t hdr;
struct tm * tm; struct tm tm;
if(useron.etoday>=cfg.level_emailperday[useron.level] && !SYSOP) { if(useron.etoday>=cfg.level_emailperday[useron.level] && !SYSOP) {
bputs(text[TooManyEmailsToday]); bputs(text[TooManyEmailsToday]);
...@@ -170,11 +170,10 @@ bool sbbs_t::netmail(char *into, char *title, long mode) ...@@ -170,11 +170,10 @@ bool sbbs_t::netmail(char *into, char *title, long mode)
} }
now=time(NULL); now=time(NULL);
tm=localtime(&now); if(localtime_r(&now,&tm)!=NULL)
if(tm!=NULL)
sprintf(hdr.time,"%02u %3.3s %02u %02u:%02u:%02u" sprintf(hdr.time,"%02u %3.3s %02u %02u:%02u:%02u"
,tm->tm_mday,mon[tm->tm_mon],TM_YEAR(tm->tm_year) ,tm.tm_mday,mon[tm.tm_mon],TM_YEAR(tm.tm_year)
,tm->tm_hour,tm->tm_min,tm->tm_sec); ,tm.tm_hour,tm.tm_min,tm.tm_sec);
hdr.destzone =addr.zone; hdr.destzone =addr.zone;
hdr.destnet =addr.net; hdr.destnet =addr.net;
......
...@@ -2244,7 +2244,6 @@ static void ctrl_thread(void* arg) ...@@ -2244,7 +2244,6 @@ static void ctrl_thread(void* arg)
node_t node; node_t node;
client_t client; client_t client;
struct tm tm; struct tm tm;
struct tm * tm_p;
struct tm cur_tm; struct tm cur_tm;
#ifdef JAVASCRIPT #ifdef JAVASCRIPT
jsval js_val; jsval js_val;
...@@ -2873,22 +2872,16 @@ static void ctrl_thread(void* arg) ...@@ -2873,22 +2872,16 @@ static void ctrl_thread(void* arg)
sockprintf(sock, "150 Directory of %s%s", local_dir, p); sockprintf(sock, "150 Directory of %s%s", local_dir, p);
now=time(NULL); now=time(NULL);
tm_p=localtime(&now); if(localtime_r(&now,&cur_tm)==NULL)
if(tm_p==NULL)
memset(&cur_tm,0,sizeof(cur_tm)); memset(&cur_tm,0,sizeof(cur_tm));
else
cur_tm=*tm_p;
glob(path,0,NULL,&g); glob(path,0,NULL,&g);
for(i=0;i<(int)g.gl_pathc;i++) { for(i=0;i<(int)g.gl_pathc;i++) {
if(detail) { if(detail) {
f.size=flength(g.gl_pathv[i]); f.size=flength(g.gl_pathv[i]);
t=fdate(g.gl_pathv[i]); t=fdate(g.gl_pathv[i]);
tm_p=localtime(&t); if(localtime_r(&t,&tm)==NULL)
if(tm_p==NULL)
memset(&tm,0,sizeof(tm)); memset(&tm,0,sizeof(tm));
else
tm=*tm_p;
fprintf(fp,"%crw-r--r-- 1 %-8s local %9ld %s %2d " fprintf(fp,"%crw-r--r-- 1 %-8s local %9ld %s %2d "
,isdir(g.gl_pathv[i]) ? 'd':'-' ,isdir(g.gl_pathv[i]) ? 'd':'-'
,scfg.sys_id ,scfg.sys_id
...@@ -3072,11 +3065,8 @@ static void ctrl_thread(void* arg) ...@@ -3072,11 +3065,8 @@ static void ctrl_thread(void* arg)
} }
if(!str