* passwd.cc (read_etc_passwd): Bother with unlocking when not in cygwin

initialization.
* grp.cc (read_etc_group): Ditto.
This commit is contained in:
Christopher Faylor 2001-09-28 07:23:18 +00:00
parent 8b51edbfa6
commit 1795c53d86
3 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,9 @@
Fri Sep 28 03:23:04 2001 Christopher Faylor <cgf@cygnus.com>
* passwd.cc (read_etc_passwd): Bother with unlocking when not
in cygwin initialization.
* grp.cc (read_etc_group): Ditto.
Fri Sep 28 02:57:03 2001 Christopher Faylor <cgf@cygnus.com>
* passwd.cc (read_etc_passwd): Don't bother with locking when

View File

@ -123,6 +123,11 @@ class group_lock
public:
group_lock (): mutex ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER) {}
void arm () {pthread_mutex_lock (&mutex); }
~group_lock ()
{
if (mutex != (pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)
pthread_mutex_unlock (&mutex);
}
};
/* Cygwin internal */

View File

@ -115,6 +115,11 @@ class passwd_lock
public:
passwd_lock (): mutex ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER) {}
void arm () {pthread_mutex_lock (&mutex); }
~passwd_lock ()
{
if (mutex != (pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)
pthread_mutex_unlock (&mutex);
}
};
/* Read in /etc/passwd and save contents in the password cache.