TIP: Click on subject to list as thread! ANSI
echo: sync_programming
to: cov-scan@synchro.net
from: scan-admin@coverity.com
date: 2024-12-02 13:42:00
subject: New Defects reported by C

Hi,

Please find the latest report on new defect(s) introduced to Synchronet found with Coverity Scan.

14 new defect(s) introduced to Synchronet found with Coverity Scan.


New defect(s) Reported-by: Coverity Scan
Showing 14 of 14 defect(s)


** CID 515601:  Program hangs  (LOCK)
/js_bbs.cpp: 3400 in js_get_node_message(JSContext *, unsigned int, unsigned long *)()


________________________________________________________________________________________________________
*** CID 515601:  Program hangs  (LOCK)
/js_bbs.cpp: 3400 in js_get_node_message(JSContext *, unsigned int, unsigned long *)()
3394     		clearline = JSVAL_TO_BOOLEAN(argv[0]);
3395
3396     	rc=JS_SUSPENDREQUEST(cx);
3397     	sbbs->getnmsg(clearline ? true : false);
3398     	JS_RESUMEREQUEST(cx, rc);
3399
>>>     CID 515601:  Program hangs  (LOCK)
>>>     Returning without unlocking "sbbs->nodefile_mutex".
3400     	return(JS_TRUE);
3401     }
3402
3403     static JSBool
3404     js_put_node_message(JSContext *cx, uintN argc, jsval *arglist)
3405     {

** CID 515600:  Error handling issues  (CHECKED_RETURN)
/download.cpp: 367 in sbbs_t::seqwait(unsigned int)()


________________________________________________________________________________________________________
*** CID 515600:  Error handling issues  (CHECKED_RETURN)
/download.cpp: 367 in sbbs_t::seqwait(unsigned int)()
361
362     	if(!devnum)
363     		return;
364     	for(start=now=time(NULL);online && now-start<90;now=time(NULL)) {
365     		if(msgabort())				/* max wait ^^^^ sec */
366     			break;
>>>     CID 515600:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "getnodedat" without checking return value (as is done elsewhere 52 out of 59 times).
367     		getnodedat(cfg.node_num,&thisnode,true);	/* open and lock this record */
368     		for(i=1;i<=cfg.sys_nodes;i++) {
369     			if(i==cfg.node_num) continue;
370     			if(getnodedat(i,&node, true)) {
371     				if((node.status==NODE_INUSE || node.status==NODE_QUIET)
372     					&& node.action==NODE_RFSD && node.aux==devnum) {

** CID 515599:  Concurrent data access violations  (MISSING_LOCK)
/putnode.cpp: 108 in sbbs_t::unlocknodedat(unsigned int)()


________________________________________________________________________________________________________
*** CID 515599:  Concurrent data access violations  (MISSING_LOCK)
/putnode.cpp: 108 in sbbs_t::unlocknodedat(unsigned int)()
102     		errormsg(WHERE, ERR_CHK, "node number", number);
103     		return false;
104     	}
105     	int result = unlock(nodefile, (number - 1) * sizeof(node_t), sizeof(node_t));
106     	if(cfg.node_misc & NM_CLOSENODEDAB) {
107     		close(nodefile);
>>>     CID 515599:  Concurrent data access violations  (MISSING_LOCK)
>>>     Accessing "this->nodefile" without holding lock "sbbs_t.nodefile_mutex". Elsewhere, "sbbs_t.nodefile" is written to with "sbbs_t.nodefile_mutex" held 4 out of 5 times.
108     		nodefile = -1;
109     	}
110     	pthread_mutex_unlock(&nodefile_mutex);
111     	return result == 0;
112     }
113

** CID 515598:    (SLEEP)


________________________________________________________________________________________________________
*** CID 515598:    (SLEEP)
/getnode.cpp: 268 in sbbs_t::getnmsg(bool)()
262     	buf[length]=0;
263
264     	if(clearline)
265     		this->clearline();
266     	else if(column)
267     		CRLF;
>>>     CID 515598:    (SLEEP)
>>>     Call to "putmsg" might sleep while holding lock "this->nodefile_mutex".
268     	putmsg(buf,P_NOATCODES);
269     	free(buf);
270
271     	return retval == 0;
272     }
273
/getnode.cpp: 265 in sbbs_t::getnmsg(bool)()
259     	}
260     	int retval = chsize(file,0L);
261     	close(file);
262     	buf[length]=0;
263
264     	if(clearline)
>>>     CID 515598:    (SLEEP)
>>>     Call to "clearline" might sleep while holding lock "this->nodefile_mutex".
265     		this->clearline();
266     	else if(column)
267     		CRLF;
268     	putmsg(buf,P_NOATCODES);
269     	free(buf);
270

** CID 515597:  Program hangs  (LOCK)
/main.cpp: 2243 in input_thread(void *)()


________________________________________________________________________________________________________
*** CID 515597:  Program hangs  (LOCK)
/main.cpp: 2243 in input_thread(void *)()
2237     		}
2238     		else
2239     #endif
2240         	rd = recv(sock, (char*)inbuf, rd, 0);
2241
2242     		if(pthread_mutex_unlock(&sbbs->input_thread_mutex)!=0)
>>>     CID 515597:  Program hangs  (LOCK)
>>>     "errormsg" locks "sbbs->nodefile_mutex" while it is locked.
2243     			sbbs->errormsg(WHERE,ERR_UNLOCK,"input_thread_mutex",0);
2244
2245     		if (rd == 0 && !socket_recvdone(sock, 0))
2246     			continue;
2247
2248     		if(rd == SOCKET_ERROR)

** CID 515596:  Program hangs  (LOCK)
/logfile.cpp: 331 in sbbs_t::errormsg(int, const char *, const char *, const char *, const char *, int, const char *)()


________________________________________________________________________________________________________
*** CID 515596:  Program hangs  (LOCK)
/logfile.cpp: 331 in sbbs_t::errormsg(int, const char *, const char *, const char *, const char *, int, const char *)()
325     		fprintf(logfile_fp,"!! %s%s", str, log_line_ending);
326     		logcol=1;
327     		fflush(logfile_fp);
328     	}
329
330     	errormsg_inside=false;
>>>     CID 515596:  Program hangs  (LOCK)
>>>     Returning without unlocking "this->nodefile_mutex".
331     }
332
333     /****************************************************************************/
334     /* Open a log file for append, supporting log rotation based on size		*/
335     /****************************************************************************/
336     extern "C" FILE* fopenlog(scfg_t* cfg, const char* path)

** CID 515595:  Program hangs  (LOCK)
/main.cpp: 4335 in sbbs_t::logoffstats()()


________________________________________________________________________________________________________
*** CID 515595:  Program hangs  (LOCK)
/main.cpp: 4335 in sbbs_t::logoffstats()()
4329
4330     	for(i=0;i<2;i++) {
4331     		FILE* fp = fopen_dstats(&cfg, i ? 0 : cfg.node_num, /* for_write: */true);
4332     		if(fp == NULL)
4333     			continue;
4334     		if(!fread_dstats(fp, &stats)) {
>>>     CID 515595:  Program hangs  (LOCK)
>>>     "errormsg" locks "this->nodefile_mutex" while it is locked.
4335     			errormsg(WHERE, ERR_READ, "dsts.ini", i);
4336     		} else {
4337     			stats.total.timeon += minutes_used;
4338     			stats.today.timeon += minutes_used;
4339     			if(!fwrite_dstats(fp, &stats, __FUNCTION__))
4340     				errormsg(WHERE, ERR_WRITE, "dsts.ini", i);

** CID 515594:    (SLEEP)


________________________________________________________________________________________________________
*** CID 515594:    (SLEEP)
/main.cpp: 4649 in sbbs_t::daily_maint()()
4643     		backup(str,cfg.user_backup_level,false);
4644     	}
4645
4646     	if(cfg.mail_backup_level) {
4647     		lputs(LOG_INFO,"DAILY: Backing-up mail data...");
4648     		smb_t mail;
>>>     CID 515594:    (SLEEP)
>>>     Call to "smb_open_sub" might sleep while holding lock "this->nodefile_mutex".
4649     		int result = smb_open_sub(&cfg, &mail, INVALID_SUB);
4650     		if(result != SMB_SUCCESS)
4651     			lprintf(LOG_ERR, "ERROR %d (%s) opening mail base", result, mail.last_error);
4652     		else {
4653     			result = smb_lock(&mail);
4654     			if(result != SMB_SUCCESS)
/main.cpp: 4778 in sbbs_t::daily_maint()()
4772     	closeuserdat(userfile);
4773
4774     	lputs(LOG_INFO,"DAILY: Purging deleted/expired e-mail");
4775     	SAFEPRINTF(smb.file,"%smail",cfg.data_dir);
4776     	smb.retry_time=cfg.smb_retry_time;
4777     	smb.subnum=INVALID_SUB;
>>>     CID 515594:    (SLEEP)
>>>     Call to "smb_open" might sleep while holding lock "this->nodefile_mutex".
4778     	if((i=smb_open(&smb))!=0)
4779     		errormsg(WHERE,ERR_OPEN,smb.file,i,smb.last_error);
4780     	else {
4781     		if(filelength(fileno(smb.shd_fp))>0) {
4782     			if((i=smb_locksmbhdr(&smb))!=0)
4783     				errormsg(WHERE,ERR_LOCK,smb.file,i,smb.last_error);

** CID 515593:    (LOCK)
/getnode.cpp: 258 in sbbs_t::getnmsg(bool)()
/getnode.cpp: 252 in sbbs_t::getnmsg(bool)()
/getnode.cpp: 242 in sbbs_t::getnmsg(bool)()
/getnode.cpp: 271 in sbbs_t::getnmsg(bool)()
/getnode.cpp: 237 in sbbs_t::getnmsg(bool)()
/getnode.cpp: 247 in sbbs_t::getnmsg(bool)()


________________________________________________________________________________________________________
*** CID 515593:    (LOCK)
/getnode.cpp: 258 in sbbs_t::getnmsg(bool)()
252     		return false;
253     	}
254     	if(read(file,buf,length)!=length) {
255     		close(file);
256     		free(buf);
257     		errormsg(WHERE,ERR_READ,str,length);
>>>     CID 515593:    (LOCK)
>>>     Returning without unlocking "this->nodefile_mutex".
258     		return false;
259     	}
260     	int retval = chsize(file,0L);
261     	close(file);
262     	buf[length]=0;
263
/getnode.cpp: 252 in sbbs_t::getnmsg(bool)()
246     		close(file);
247     		return true;
248     	}
249     	if((buf=(char *)malloc(length+1))==NULL) {
250     		close(file);
251     		errormsg(WHERE,ERR_ALLOC,str,length+1);
>>>     CID 515593:    (LOCK)
>>>     Returning without unlocking "this->nodefile_mutex".
252     		return false;
253     	}
254     	if(read(file,buf,length)!=length) {
255     		close(file);
256     		free(buf);
257     		errormsg(WHERE,ERR_READ,str,length);
/getnode.cpp: 242 in sbbs_t::getnmsg(bool)()
236     	if(flength(str)<1L)
237     		return true;
238     	if((file=nopen(str,O_RDWR))==-1) {
239     		/**
240     			errormsg(WHERE,ERR_OPEN,str,O_RDWR);
241     		**/
>>>     CID 515593:    (LOCK)
>>>     Returning without unlocking "this->nodefile_mutex".
242     		return false;
243     	}
244     	length=(long)filelength(file);
245     	if(length <= 0) {
246     		close(file);
247     		return true;
/getnode.cpp: 271 in sbbs_t::getnmsg(bool)()
265     		this->clearline();
266     	else if(column)
267     		CRLF;
268     	putmsg(buf,P_NOATCODES);
269     	free(buf);
270
>>>     CID 515593:    (LOCK)
>>>     Returning without unlocking "this->nodefile_mutex".
271     	return retval == 0;
272     }
273
274     /****************************************************************************/
275     /* 'ext' must be at least 128 bytes!                                        */
276     /****************************************************************************/
/getnode.cpp: 237 in sbbs_t::getnmsg(bool)()
231     		thisnode.misc&=~NODE_NMSG;          /* clear the NMSG flag */
232     		putnodedat(cfg.node_num,&thisnode);
233     	}
234
235     	SAFEPRINTF2(str,"%smsgs/n%3.3u.msg",cfg.data_dir,cfg.node_num);
236     	if(flength(str)<1L)
>>>     CID 515593:    (LOCK)
>>>     Returning without unlocking "this->nodefile_mutex".
237     		return true;
238     	if((file=nopen(str,O_RDWR))==-1) {
239     		/**
240     			errormsg(WHERE,ERR_OPEN,str,O_RDWR);
241     		**/
242     		return false;
/getnode.cpp: 247 in sbbs_t::getnmsg(bool)()
241     		**/
242     		return false;
243     	}
244     	length=(long)filelength(file);
245     	if(length <= 0) {
246     		close(file);
>>>     CID 515593:    (LOCK)
>>>     Returning without unlocking "this->nodefile_mutex".
247     		return true;
248     	}
249     	if((buf=(char *)malloc(length+1))==NULL) {
250     		close(file);
251     		errormsg(WHERE,ERR_ALLOC,str,length+1);
252     		return false;

** CID 515592:    (SLEEP)


________________________________________________________________________________________________________
*** CID 515592:    (SLEEP)
/getnode.cpp: 162 in sbbs_t::nodesync(bool)()
156     				thisnode.misc&=~NODE_UDAT;
157     				putnodedat(cfg.node_num,&thisnode);
158     			}
159     		}
160     		if(!(sys_status&SS_MOFF)) {
161     			if(thisnode.misc&NODE_MSGW)
>>>     CID 515592:    (SLEEP)
>>>     Call to "getsmsg" might sleep while holding lock "this->nodefile_mutex".
162     				getsmsg(useron.number, clearline); 	/* getsmsg clears MSGW flag */
163     			if(thisnode.misc&NODE_NMSG)
164     				getnmsg(clearline);					/* getnmsg clears NMSG flag */
165     		}
166     	}
167
/getnode.cpp: 174 in sbbs_t::nodesync(bool)()
168     	if(cfg.sync_mod[0])
169     		exec_bin(cfg.sync_mod,&main_csi);
170
171     	if(thisnode.misc&NODE_INTR) {
172     		bputs(text[NodeLocked]);
173     		logline(LOG_NOTICE,nulstr,"Interrupted");
>>>     CID 515592:    (SLEEP)
>>>     Call to "hangup" might sleep while holding lock "this->nodefile_mutex".
174     		hangup();
175     		nodesync_inside=0;
176     		return;
177     	}
178
179     	if(thisnode.misc&NODE_LCHAT) { // pulled into local chat with sysop
/getnode.cpp: 164 in sbbs_t::nodesync(bool)()
158     			}
159     		}
160     		if(!(sys_status&SS_MOFF)) {
161     			if(thisnode.misc&NODE_MSGW)
162     				getsmsg(useron.number, clearline); 	/* getsmsg clears MSGW flag */
163     			if(thisnode.misc&NODE_NMSG)
>>>     CID 515592:    (SLEEP)
>>>     Call to "getnmsg" might sleep while holding lock "this->nodefile_mutex".
164     				getnmsg(clearline);					/* getnmsg clears NMSG flag */
165     		}
166     	}
167
168     	if(cfg.sync_mod[0])
169     		exec_bin(cfg.sync_mod,&main_csi);
/getnode.cpp: 211 in sbbs_t::nodesync(bool)()
205     	}
206
207     	if(sys_status&SS_USERON && online && (timeleft/60)<(5-timeleft_warn)
208     		&& !SYSOP) {
209     		timeleft_warn=5-(timeleft/60);
210     		if(!(sys_status&SS_MOFF)) {
>>>     CID 515592:    (SLEEP)
>>>     Call to "attr" might sleep while holding lock "this->nodefile_mutex".
211     			attr(LIGHTGRAY);
212     			bprintf(text[OnlyXminutesLeft]
213     				,((ushort)timeleft/60)+1,(timeleft/60) ? "s" : nulstr);
214     		}
215     	}
216
/getnode.cpp: 217 in sbbs_t::nodesync(bool)()
211     			attr(LIGHTGRAY);
212     			bprintf(text[OnlyXminutesLeft]
213     				,((ushort)timeleft/60)+1,(timeleft/60) ? "s" : nulstr);
214     		}
215     	}
216
>>>     CID 515592:    (SLEEP)
>>>     Call to "attr" might sleep while holding lock "this->nodefile_mutex".
217     	attr(atr);	/* replace original attributes */
218     	nodesync_inside=0;
219     }
220
221     /****************************************************************************/
222     /* Prints short messages waiting for this node, if any...                   */
/getnode.cpp: 181 in sbbs_t::nodesync(bool)()
175     		nodesync_inside=0;
176     		return;
177     	}
178
179     	if(thisnode.misc&NODE_LCHAT) { // pulled into local chat with sysop
180     		saveline();
>>>     CID 515592:    (SLEEP)
>>>     Call to "privchat" might sleep while holding lock "this->nodefile_mutex".
181     		privchat(true);
182     		restoreline();
183     	}
184
185     	if(thisnode.misc&NODE_FCHAT) { // forced into private chat
186     		int n = getpagingnode(&cfg);
/getnode.cpp: 182 in sbbs_t::nodesync(bool)()
176     		return;
177     	}
178
179     	if(thisnode.misc&NODE_LCHAT) { // pulled into local chat with sysop
180     		saveline();
181     		privchat(true);
>>>     CID 515592:    (SLEEP)
>>>     Call to "restoreline" might sleep while holding lock "this->nodefile_mutex".
182     		restoreline();
183     	}
184
185     	if(thisnode.misc&NODE_FCHAT) { // forced into private chat
186     		int n = getpagingnode(&cfg);
187     		if(n) {
/getnode.cpp: 197 in sbbs_t::nodesync(bool)()
191     			action = save_action;
192     			restoreline();
193     		}
194     		if(getnodedat(cfg.node_num, &thisnode, true)) {
195     			thisnode.action = action;
196     			thisnode.misc &= ~NODE_FCHAT;
>>>     CID 515592:    (SLEEP)
>>>     Call to "putnodedat" might sleep while holding lock "this->nodefile_mutex".
197     			putnodedat(cfg.node_num, &thisnode);
198     		}
199     	}
200
201     	if(sys_status&SS_USERON && memcmp(&nodesync_user,&useron,sizeof(user_t))) {
202     		getusrdirs();

** CID 515591:    (LOCK)
/getnode.cpp: 219 in sbbs_t::nodesync(bool)()
/getnode.cpp: 157 in sbbs_t::nodesync(bool)()


________________________________________________________________________________________________________
*** CID 515591:    (LOCK)
/getnode.cpp: 219 in sbbs_t::nodesync(bool)()
213     				,((ushort)timeleft/60)+1,(timeleft/60) ? "s" : nulstr);
214     		}
215     	}
216
217     	attr(atr);	/* replace original attributes */
218     	nodesync_inside=0;
>>>     CID 515591:    (LOCK)
>>>     Returning without unlocking "this->nodefile_mutex".
219     }
220
221     /****************************************************************************/
222     /* Prints short messages waiting for this node, if any...                   */
223     /****************************************************************************/
224     bool sbbs_t::getnmsg(bool clearline)
/getnode.cpp: 164 in sbbs_t::nodesync(bool)()
158     			}
159     		}
160     		if(!(sys_status&SS_MOFF)) {
161     			if(thisnode.misc&NODE_MSGW)
162     				getsmsg(useron.number, clearline); 	/* getsmsg clears MSGW flag */
163     			if(thisnode.misc&NODE_NMSG)
>>>     CID 515591:    (LOCK)
>>>     "getnmsg" locks "this->nodefile_mutex" while it is locked.
164     				getnmsg(clearline);					/* getnmsg clears NMSG flag */
165     		}
166     	}
167
168     	if(cfg.sync_mod[0])
169     		exec_bin(cfg.sync_mod,&main_csi);
/getnode.cpp: 197 in sbbs_t::nodesync(bool)()
191     			action = save_action;
192     			restoreline();
193     		}
194     		if(getnodedat(cfg.node_num, &thisnode, true)) {
195     			thisnode.action = action;
196     			thisnode.misc &= ~NODE_FCHAT;
>>>     CID 515591:    (LOCK)
>>>     "putnodedat" locks "this->nodefile_mutex" while it is locked.
197     			putnodedat(cfg.node_num, &thisnode);
198     		}
199     	}
200
201     	if(sys_status&SS_USERON && memcmp(&nodesync_user,&useron,sizeof(user_t))) {
202     		getusrdirs();
/getnode.cpp: 157 in sbbs_t::nodesync(bool)()
151     			}
152     		}
153     		if(thisnode.misc&NODE_UDAT && !(useron.rest&FLAG('G'))) {   /* not guest */
154     			getuserdat(&cfg, &useron);
155     			if(getnodedat(cfg.node_num,&thisnode, true)) {
156     				thisnode.misc&=~NODE_UDAT;
>>>     CID 515591:    (LOCK)
>>>     "putnodedat" locks "this->nodefile_mutex" while it is locked.
157     				putnodedat(cfg.node_num,&thisnode);
158     			}
159     		}
160     		if(!(sys_status&SS_MOFF)) {
161     			if(thisnode.misc&NODE_MSGW)
162     				getsmsg(useron.number, clearline); 	/* getsmsg clears MSGW flag */

** CID 515590:    (LOCK)
/un_qwk.cpp: 94 in sbbs_t::unpack_qwk(char *, unsigned int)()
/un_qwk.cpp: 123 in sbbs_t::unpack_qwk(char *, unsigned int)()


________________________________________________________________________________________________________
*** CID 515590:    (LOCK)
/un_qwk.cpp: 94 in sbbs_t::unpack_qwk(char *, unsigned int)()
88     		lprintf(LOG_ERR, "libarchive error %ld (%s) extracting %s", file_count, error, packet);
89     		if(*cfg.qhub[hubnum]->unpack == '\0')
90     			return false;
91     		i=external(cmdstr(cfg.qhub[hubnum]->unpack,packet,ALLFILES,NULL),EX_OFFLINE);
92     		if(i) {
93     			errormsg(WHERE,ERR_EXEC,cmdstr(cfg.qhub[hubnum]->unpack,packet,ALLFILES,NULL),i);
>>>     CID 515590:    (LOCK)
>>>     Returning without unlocking "this->input_thread_mutex".
94     			return(false);
95     		}
96     	}
97     	SAFEPRINTF(str,"%sMESSAGES.DAT",cfg.temp_dir);
98     	if(!fexistcase(str)) {
99     		lprintf(LOG_WARNING,"%s doesn't contain MESSAGES.DAT (%s)",packet,str);
/un_qwk.cpp: 123 in sbbs_t::unpack_qwk(char *, unsigned int)()
117     		remove(fname);
118     	}
119     	SAFEPRINTF(fname, "%sVOTING.DAT", cfg.temp_dir);
120     	if(fexistcase(fname)) {
121     		lprintf(LOG_DEBUG, "Reading %s", fname);
122     		if((fp=fopen(fname,"r")) == NULL)
>>>     CID 515590:    (LOCK)
>>>     "errormsg" locks "this->nodefile_mutex" while it is locked.
123     			errormsg(WHERE,ERR_OPEN,fname,O_RDONLY);
124     		else {
125     			voting=iniReadFile(fp);
126     			fclose(fp);
127     		}
128     		remove(fname);

** CID 515589:  Error handling issues  (CHECKED_RETURN)
/logon.cpp: 124 in sbbs_t::logon()()


________________________________________________________________________________________________________
*** CID 515589:  Error handling issues  (CHECKED_RETURN)
/logon.cpp: 124 in sbbs_t::logon()()
118     				,useron.number,useron.alias);
119     			logline(LOG_NOTICE,"+!",str);
120     			hangup();
121     			return(false);
122     		}
123     		if(yesno(text[RemoveNodeLockQ])) {
>>>     CID 515589:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "getnodedat" without checking return value (as is done elsewhere 52 out of 59 times).
124     			getnodedat(cfg.node_num,&thisnode, true);
125     			logline("S-","Removed Node Lock");
126     			thisnode.misc&=~NODE_LOCK;
127     		}
128     		else
129     			getnodedat(cfg.node_num,&thisnode, true);

** CID 515588:    (SLEEP)
/main.cpp: 3450 in event_thread(void *)()
/main.cpp: 3272 in event_thread(void *)()


________________________________________________________________________________________________________
*** CID 515588:    (SLEEP)
/main.cpp: 3277 in event_thread(void *)()
3271     						while(!sbbs->terminated) {
3272     							mswait(1000);
3273     							now=time(NULL);
3274     							if(now-start>10 && now-lastnodechk<10)
3275     								continue;
3276     							for(j=first_node;j<=last_node;j++) {
>>>     CID 515588:    (SLEEP)
>>>     Call to "getnodedat" might sleep while holding lock "sbbs->nodefile_mutex".
3277     								if(!sbbs->getnodedat(j,&node, true))
3278     									continue;
3279     								if(node.status==NODE_WFC)
3280     									node.status=NODE_EVENT_LIMBO;
3281     								node.aux=sbbs->cfg.event[i]->node;
3282     								sbbs->putnodedat(j,&node);
/main.cpp: 3450 in event_thread(void *)()
3444     						}
3445     					}
3446     				}
3447     			}
3448     		}
3449     		sbbs->event_code = nulstr;
>>>     CID 515588:    (SLEEP)
>>>     Call to "nanosleep" might sleep while holding lock "sbbs->nodefile_mutex".
3450     		mswait(1000);
3451     	}
3452     	sbbs->cfg.node_num=0;
3453     	sbbs->useron.number = 0;
3454     	sbbs->js_cleanup();
3455
/main.cpp: 3373 in event_thread(void *)()
3367     					&& (sbbs->cfg.event[i]->nodecfg.event[i]->node>last_node)) {
3368     					sbbs->lprintf(LOG_NOTICE,"Changing node status for nodes %d through %d to WFC"
3369     						,first_node,last_node);
3370     					sbbs->cfg.event[i]->last=(time32_t)now;
3371     					for(j=first_node;j<=last_node;j++) {
3372     						node.status=NODE_INVALID_STATUS;
>>>     CID 515588:    (SLEEP)
>>>     Call to "getnodedat" might sleep while holding lock "sbbs->nodefile_mutex".
3373     						if(!sbbs->getnodedat(j,&node, true))
3374     							continue;
3375     						node.status=NODE_WFC;
3376     						sbbs->putnodedat(j,&node);
3377     					}
3378     				}
/main.cpp: 3413 in event_thread(void *)()
3407     					cmd = sbbs->cmdstr(cmd, nulstr, sbbs->cfg.event[i]->dir, NULL);
3408     					sbbs->lprintf(LOG_INFO,"Running %s%stimed event: %s"
3409     						,native_executable(&sbbs->cfg, cmd, ex_mode) ? "native ":"16-bit DOS "
3410     						,(ex_mode&EX_BG)		? "background ":""
3411     						,cmd);
3412     					{
>>>     CID 515588:    (SLEEP)
>>>     Call to "external" might sleep while holding lock "sbbs->nodefile_mutex".
3413     						int result = sbbs->external(cmd, ex_mode, sbbs->cfg.event[i]->dir);
3414     						if(!(ex_mode&EX_BG))
3415     							sbbs->lprintf(result ? sbbs->cfg.event[i]->errlevel : LOG_INFO, "Timed event: '%s' returned %d", cmd, result);
3416     						else
3417     							sbbs->lprintf(LOG_DEBUG, "Background timed event spawned: %s", cmd);
3418     					}
/main.cpp: 3277 in event_thread(void *)()
3271     						while(!sbbs->terminated) {
3272     							mswait(1000);
3273     							now=time(NULL);
3274     							if(now-start>10 && now-lastnodechk<10)
3275     								continue;
3276     							for(j=first_node;j<=last_node;j++) {
>>>     CID 515588:    (SLEEP)
>>>     Call to "getnodedat" might sleep while holding lock "sbbs->nodefile_mutex".
3277     								if(!sbbs->getnodedat(j,&node, true))
3278     									continue;
3279     								if(node.status==NODE_WFC)
3280     									node.status=NODE_EVENT_LIMBO;
3281     								node.aux=sbbs->cfg.event[i]->node;
3282     								sbbs->putnodedat(j,&node);
/main.cpp: 2986 in event_thread(void *)()
2980     				if(!fexist(fname))
2981     					continue;
2982     				sbbs->useron.number = 0;
2983     				sbbs->lprintf(LOG_INFO, "QWK pack semaphore signaled: %s", fname);
2984     				int usernum = atoi(fname+offset);
2985     				sbbs->useron.number = usernum;
>>>     CID 515588:    (SLEEP)
>>>     Call to "getuserdat" might sleep while holding lock "sbbs->nodefile_mutex".
2986     				int retval = getuserdat(&sbbs->cfg,&sbbs->useron);
2987     				if(retval != 0) {
2988     					sbbs->lprintf(LOG_WARNING, "ERROR %d reading user data for user #%d", retval, usernum);
2989     					sbbs->fremove(WHERE, fname, /* log-all-errors: */true);
2990     					continue;
2991     				}
/main.cpp: 3272 in event_thread(void *)()
3266     						sbbs->lprintf(LOG_DEBUG,"event last run: %s (0x%08x)"
3267     							,sbbs->timestr(sbbs->cfg.event[i]->last)
3268     							,sbbs->cfg.event[i]->last);
3269     						lastnodechk=0;	 /* really last event time check */
3270     						start=time(NULL);
3271     						while(!sbbs->terminated) {
>>>     CID 515588:    (SLEEP)
>>>     Call to "nanosleep" might sleep while holding lock "sbbs->nodefile_mutex".
3272     							mswait(1000);
3273     							now=time(NULL);
3274     							if(now-start>10 && now-lastnodechk<10)
3275     								continue;
3276     							for(j=first_node;j<=last_node;j++) {
3277     								if(!sbbs->getnodedat(j,&node, true))


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=u001.AxU2LYlgjL6eX23u9ErQy-2BKADyCpvUKOL6EWmZljiu4gdQbQRNsarCbK0jIoVQSWT2zCPijRqaed4AhLiEI9Z7MR9SJQ09ot5XPbn9SW-2F14-3D0VuE_7FYjIqE8olEh4k02KWtt1r1LGSyuXVEtCuKuJCXgAQZXtRHBZwsv7Kfty0nOtNaK0UAFlR-2FrVR2f6CKktOSW3KEH5A-2BAGbll45RILco6MRWsB-2BPA-2F5LbzoDmAwnm2EdPSGWu8DKQDA8ovxbR0nzs0zWwn4zpQwqZ0g5MQ5Uxv60wCv-2BEyap91XzPuWSQ2OUE7j0iN0wndXT1J2mredhBFg-3D-3D


--- SBBSecho 3.23-Linux
                                                                                                               
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)

SOURCE: echomail via QWK@pharcyde.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.