Skip to content
Snippets Groups Projects
Commit b6062fa3 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

More nodefile_mutex fixes

Need to unlock the mutex before calling errormsg().

Need unlock the mutex in error path of unlocknodedat().

I'm not clear why this would, but it might resolve CID 515601 which looks
like false positive to me: getnmsg()->putnodedat() should never leave
nodefile_mutex locked.
parent a4dea66e
No related branches found
No related tags found
No related merge requests found
......@@ -66,8 +66,8 @@ bool sbbs_t::putnodedat(uint number, node_t* node)
pthread_mutex_lock(&nodefile_mutex);
if(nodefile==-1) {
if((nodefile=nopen(path,O_CREAT|O_RDWR|O_DENYNONE))==-1) {
errormsg(WHERE,ERR_OPEN,path,O_CREAT|O_RDWR|O_DENYNONE);
pthread_mutex_unlock(&nodefile_mutex);
errormsg(WHERE,ERR_OPEN,path,O_CREAT|O_RDWR|O_DENYNONE);
return false;
}
}
......@@ -99,6 +99,7 @@ bool sbbs_t::putnodedat(uint number, node_t* node)
bool sbbs_t::unlocknodedat(uint number)
{
if(number < 1 || number > cfg.sys_nodes) {
pthread_mutex_unlock(&nodefile_mutex);
errormsg(WHERE, ERR_CHK, "node number", number);
return false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment