--- pwdgrp.h.new 2002-11-28 23:17:54.000000000 -0500 +++ pwdgrp.h 2002-11-29 10:41:56.000000000 -0500 @@ -34,25 +34,28 @@ class pwdgrp_check { public: pwdgrp_check () : state (uninitialized) {} - operator pwdgrp_state () + BOOL isinitializing () { - if (state != uninitialized && file_w32[0] && cygheap->etc_changed ()) - { - HANDLE h; - WIN32_FIND_DATA data; - - if ((h = FindFirstFile (file_w32, &data)) != INVALID_HANDLE_VALUE) + if (state <= initializing) + state = initializing; + else if (cygheap->etc_changed ()) + { + if (!file_w32[0]) + state = initializing; + else { - if (CompareFileTime (&data.ftLastWriteTime, &last_modified) > 0) - state = initializing; - FindClose (h); + HANDLE h; + WIN32_FIND_DATA data; + + if ((h = FindFirstFile (file_w32, &data)) != INVALID_HANDLE_VALUE) + { + if (CompareFileTime (&data.ftLastWriteTime, &last_modified) > 0) + state = initializing; + FindClose (h); + } } } - return state; - } - void operator = (pwdgrp_state nstate) - { - state = nstate; + return state == initializing; } BOOL isuninitialized () const { return state == uninitialized; } void set_last_modified (HANDLE fh, const char *name) @@ -60,6 +63,7 @@ public: if (!file_w32[0]) strcpy (file_w32, name); GetFileTime (fh, NULL, NULL, &last_modified); + state = loaded; } }; --- passwd.cc.new 2002-11-28 23:26:28.000000000 -0500 +++ passwd.cc 2002-11-29 10:42:36.000000000 -0500 @@ -140,7 +140,7 @@ read_etc_passwd () passwd_lock here (cygwin_finished_initializing); /* if we got blocked by the mutex, then etc_passwd may have been processed */ - if (passwd_state <= initializing) + if (passwd_state.isinitializing ()) { curr_lines = 0; if (pr.open ("/etc/passwd")) @@ -153,7 +153,6 @@ read_etc_passwd () pr.close (); debug_printf ("Read /etc/passwd, %d lines", curr_lines); } - passwd_state = loaded; static char linebuf[1024]; char strbuf[128] = ""; @@ -216,7 +215,7 @@ struct passwd * internal_getpwuid (__uid32_t uid, BOOL check) { if (passwd_state.isuninitialized () - || (check && passwd_state <= initializing)) + || (check && passwd_state.isinitializing ())) read_etc_passwd (); for (int i = 0; i < curr_lines; i++) @@ -229,7 +228,7 @@ struct passwd * internal_getpwnam (const char *name, BOOL check) { if (passwd_state.isuninitialized () - || (check && passwd_state <= initializing)) + || (check && passwd_state.isinitializing ())) read_etc_passwd (); for (int i = 0; i < curr_lines; i++) @@ -351,7 +350,7 @@ getpwnam_r (const char *nam, struct pass extern "C" struct passwd * getpwent (void) { - if (passwd_state <= initializing) + if (passwd_state.isinitializing ()) read_etc_passwd (); if (pw_pos < curr_lines) @@ -394,7 +393,7 @@ getpass (const char * prompt) #endif struct termios ti, newti; - if (passwd_state <= initializing) + if (passwd_state.isinitializing ()) read_etc_passwd (); cygheap_fdget fhstdin (0); --- grp.cc.new 2002-11-28 23:30:04.000000000 -0500 +++ grp.cc 2002-11-29 10:43:12.000000000 -0500 @@ -135,7 +135,7 @@ read_etc_group () group_lock here (cygwin_finished_initializing); /* if we got blocked by the mutex, then etc_group may have been processed */ - if (group_state <= initializing) + if (group_state.isinitializing ()) { for (int i = 0; i < curr_lines; i++) if ((group_buf + i)->gr_mem != &null_ptr) @@ -152,7 +152,6 @@ read_etc_group () gr.close (); debug_printf ("Read /etc/group, %d lines", curr_lines); } - group_state = loaded; /* Complete /etc/group in memory if needed */ if (!internal_getgrgid (myself->gid)) @@ -199,7 +198,7 @@ internal_getgrgid (__gid32_t gid, BOOL c struct __group32 * default_grp = NULL; if (group_state.isuninitialized () - || (check && group_state <= initializing)) + || (check && group_state.isinitializing ())) read_etc_group (); for (int i = 0; i < curr_lines; i++) @@ -216,7 +215,7 @@ struct __group32 * internal_getgrnam (const char *name, BOOL check) { if (group_state.isuninitialized () - || (check && group_state <= initializing)) + || (check && group_state.isinitializing ())) read_etc_group (); for (int i = 0; i < curr_lines; i++) @@ -281,7 +280,7 @@ endgrent () extern "C" struct __group32 * getgrent32 () { - if (group_state <= initializing) + if (group_state.isinitializing ()) read_etc_group (); if (grp_pos < curr_lines)