aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-01-31 17:00:42 +0000
committerChristopher Faylor <me@cgf.cx>2003-01-31 17:00:42 +0000
commit949c3da11ad67ad4ad46ff4429bd85b4dae9eb8a (patch)
tree4488ca609816ec4df87f90cbcccec2ed7ecd40ba /winsup
parent485d85bfa72707af58c49e0359ec1eed2fb88de7 (diff)
downloadnewlib-949c3da11ad67ad4ad46ff4429bd85b4dae9eb8a.zip
newlib-949c3da11ad67ad4ad46ff4429bd85b4dae9eb8a.tar.gz
newlib-949c3da11ad67ad4ad46ff4429bd85b4dae9eb8a.tar.bz2
* passwd.cc (pwdgrp::read_passwd): linebuf *must* be static (from Pierre
Humblet). * pwdgrp.h (pwdgrp::refresh): Avoid calling read function if we already have lock since that means we are in the process of reading the file.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/passwd.cc3
-rw-r--r--winsup/cygwin/pwdgrp.h6
3 files changed, 12 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 98370c0..72f3292 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2003-01-31 Christopher Faylor <cgf@redhat.com>
+
+ * passwd.cc (pwdgrp::read_passwd): linebuf *must* be static (from
+ Pierre Humblet).
+ * pwdgrp.h (pwdgrp::refresh): Avoid calling read function if we already
+ have lock since that means we are in the process of reading the file.
+
2003-01-31 Jason Tishler <jason@tishler.net>
* shared.cc (shared_info::heap_chunk_size): Use correct variable when
diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc
index ee12392..5dd8712 100644
--- a/winsup/cygwin/passwd.cc
+++ b/winsup/cygwin/passwd.cc
@@ -66,6 +66,7 @@ pwdgrp::read_passwd ()
if (wincap.has_security ())
{
+ /* must be static */
static char NO_COPY pretty_ls[] = "????????:*:-1:-1:";
add_line (pretty_ls);
cygsid tu = cygheap->user.sid ();
@@ -81,7 +82,7 @@ pwdgrp::read_passwd ()
myself->uid != (__uid32_t) pw->pw_uid &&
!internal_getpwuid (myself->uid))))
{
- char linebuf[1024];
+ static char NO_COPY linebuf[1024]; // must be static
(void) cygheap->user.ontherange (CH_HOME, NULL);
snprintf (linebuf, sizeof (linebuf), "%s:*:%lu:%lu:,%s:%s:/bin/sh",
cygheap->user.name (),
diff --git a/winsup/cygwin/pwdgrp.h b/winsup/cygwin/pwdgrp.h
index 73d41a0..51b489f 100644
--- a/winsup/cygwin/pwdgrp.h
+++ b/winsup/cygwin/pwdgrp.h
@@ -71,9 +71,9 @@ public:
{
if (!check && initialized)
return;
- pglock->acquire ();
- if (!initialized || (check && etc::file_changed (etc_ix)))
- (this->*read) ();
+ if (pglock->acquire () == 1 &&
+ (!initialized || (check && etc::file_changed (etc_ix))))
+ (this->*read) ();
pglock->release ();
}