diff options
author | Christopher Faylor <me@cgf.cx> | 2001-09-28 11:23:18 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-09-28 11:23:18 +0400 |
commit | 1795c53d86d904ea683b602260830c1caa1bca97 (patch) | |
tree | 785ae58baf5a7262a45ca53a3a26a86f7a3954bb /winsup | |
parent | 8b51edbfa6c8f372f9ce68c7edad0046b71ce1fd (diff) |
* passwd.cc (read_etc_passwd): Bother with unlocking when not in cygwin
initialization.
* grp.cc (read_etc_group): Ditto.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/grp.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/passwd.cc | 5 |
3 files changed, 16 insertions, 0 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index a2fdacc79..a9718b3e6 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -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 diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index e4a4afd6c..d9e7b02b4 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -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 */ diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index c86c07b6a..092473b12 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -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. |