* times.cc (hires::prime): Restore thread priority on failure condition.
* uinfo.cc (uinfo_init): Use more robust method for determining if process was invoked from a non-cygwin process. * sync.h (muto::init): Eliminate "inheritance" parameter. (new_muto): Reflect removal of parameter. * sync.cc (muto::init): Ditto. * cygheap.cc (cygheap_init): Ditto. * debug.cc (threadname_init): Ditto. * exceptions.cc (events_init): Ditto. * malloc.cc (malloc_init): Ditto. * path.cc (cwdstuff::init): Ditto. * sigproc.cc (sigproc_init): Ditto. * grp.cc (group_lock): Use different method for locking with static member. (read_etc_group): REALLY ensure that read lock mutex is released. * passwd.cc (passwd_lock): Use different method for locking with static member. (read_etc_passwd): REALLY ensure that read lock mutex is released. * shared.cc (sec_user): Correct reversed inheritance test.
This commit is contained in:
@@ -111,17 +111,24 @@ add_pwd_line (char *line)
|
||||
|
||||
class passwd_lock
|
||||
{
|
||||
pthread_mutex_t mutex;
|
||||
bool armed;
|
||||
static NO_COPY pthread_mutex_t mutex;
|
||||
public:
|
||||
passwd_lock (): mutex ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER) {}
|
||||
void arm () {pthread_mutex_lock (&mutex); }
|
||||
passwd_lock (bool doit)
|
||||
{
|
||||
if (doit)
|
||||
pthread_mutex_lock (&mutex);
|
||||
armed = doit;
|
||||
}
|
||||
~passwd_lock ()
|
||||
{
|
||||
if (mutex != (pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)
|
||||
if (armed)
|
||||
pthread_mutex_unlock (&mutex);
|
||||
}
|
||||
};
|
||||
|
||||
pthread_mutex_t NO_COPY passwd_lock::mutex = (pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/* Read in /etc/passwd and save contents in the password cache.
|
||||
This sets passwd_state to loaded or emulated so functions in this file can
|
||||
tell that /etc/passwd has been read in or will be emulated. */
|
||||
@@ -133,10 +140,7 @@ read_etc_passwd ()
|
||||
* for non-shared mutexs in the future. Also, this function will at most be called
|
||||
* once from each thread, after that the passwd_state test will succeed
|
||||
*/
|
||||
static NO_COPY passwd_lock here;
|
||||
|
||||
if (cygwin_finished_initializing)
|
||||
here.arm ();
|
||||
passwd_lock here (cygwin_finished_initializing);
|
||||
|
||||
/* if we got blocked by the mutex, then etc_passwd may have been processed */
|
||||
if (passwd_state != uninitialized)
|
||||
|
Reference in New Issue
Block a user