Skip to content
Snippets Groups Projects
Commit afa0eaf1 authored by deuce's avatar deuce
Browse files

Move thread_up() call of do_set*id() inside of the mutex protection to

prevent threads from exiting while ids are beign changed.
parent c55cad1e
No related branches found
No related tags found
No related merge requests found
......@@ -383,6 +383,13 @@ static void thread_up(void* p, BOOL up, BOOL setuid)
static pthread_mutex_t mutex;
static BOOL mutex_initialized;
if(!mutex_initialized) {
pthread_mutex_init(&mutex,NULL);
mutex_initialized=TRUE;
}
pthread_mutex_lock(&mutex);
#ifdef _THREAD_SUID_BROKEN
if(up && setuid) {
do_seteuid(FALSE);
......@@ -390,12 +397,6 @@ static void thread_up(void* p, BOOL up, BOOL setuid)
}
#endif
if(!mutex_initialized) {
pthread_mutex_init(&mutex,NULL);
mutex_initialized=TRUE;
}
pthread_mutex_lock(&mutex);
if(up)
thread_count++;
else if(thread_count>0)
......
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