From: cgf Date: Fri, 17 Jan 2003 18:05:32 +0000 (+0000) Subject: * dcrt0.cc (initialize_env): Use colon for CYGWIN_DEBUG separator. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=ad099e16dbb2f672adbc7c2a05dec80bd36c3be3;p=pf3gnuchains%2Fpf3gnuchains3x.git * dcrt0.cc (initialize_env): Use colon for CYGWIN_DEBUG separator. * grp.cc: Change most statics to NO_COPY throughout. * passwd.cc: Ditto. * pwdgrp.h: Change some BOOLs to bools. (pwdgrp::pwdgrp): Remove unneeded constructor. * passwd.cc: Change BOOL to bool throughout. --- diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 578a2765ac..19c0779cae 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,15 @@ +2003-01-17 Christopher Faylor + + * dcrt0.cc (initialize_env): Use colon for CYGWIN_DEBUG separator. + * grp.cc: Change most statics to NO_COPY throughout. + * passwd.cc: Ditto. + +2003-01-17 Christopher Faylor + + * pwdgrp.h: Change some BOOLs to bools. + (pwdgrp::pwdgrp): Remove unneeded constructor. + * passwd.cc: Change BOOL to bool throughout. + 2003-01-17 Corinna Vinschen * cygwin.din: Add strerror_r. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index f40264584d..004837d6ed 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -809,7 +809,7 @@ initial_env () len = GetModuleFileName (NULL, buf1, MAX_PATH); strlwr (buf1); strlwr (buf); - char *p = strchr (buf, '='); + char *p = strchr (buf, ':'); if (!p) p = (char *) "gdb.exe -nw"; else diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index 652b058ed6..85ec51dc65 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -29,18 +29,14 @@ details. */ /* Read /etc/group only once for better performance. This is done on the first call that needs information from it. */ -static struct __group32 *group_buf; /* group contents in memory */ -static int curr_lines; -static int max_lines; +static struct __group32 NO_COPY *group_buf; /* group contents in memory */ +static int NO_COPY curr_lines; +static int NO_COPY max_lines; /* Position in the group cache */ -#ifdef _MT_SAFE #define grp_pos _reent_winsup ()->_grp_pos -#else -static int grp_pos = 0; -#endif -static pwdgrp gr; +static pwdgrp NO_COPY gr; static char * NO_COPY null_ptr; static int @@ -107,7 +103,7 @@ class group_lock { bool armed; static NO_COPY pthread_mutex_t mutex; - public: +public: group_lock (bool doit) { if (armed = doit) @@ -162,7 +158,7 @@ read_etc_group () debug_printf ("Completing /etc/group: %s", linebuf); add_grp_line (linebuf); } - static char pretty_ls[] = "????????::-1:"; + static char NO_COPY pretty_ls[] = "????????::-1:"; if (wincap.has_security ()) add_grp_line (pretty_ls); } @@ -185,7 +181,7 @@ internal_getgrsid (cygsid &sid) } struct __group32 * -internal_getgrgid (__gid32_t gid, BOOL check) +internal_getgrgid (__gid32_t gid, bool check) { if (gr.isuninitialized () || (check && gr.isinitializing ())) read_etc_group (); @@ -197,7 +193,7 @@ internal_getgrgid (__gid32_t gid, BOOL check) } struct __group32 * -internal_getgrnam (const char *name, BOOL check) +internal_getgrnam (const char *name, bool check) { if (gr.isuninitialized () || (check && gr.isinitializing ())) read_etc_group (); @@ -236,7 +232,7 @@ getgrgid32 (__gid32_t gid) extern "C" struct __group16 * getgrgid (__gid16_t gid) { - static struct __group16 g16; + static struct __group16 g16; /* FIXME: thread-safe? */ return grp32togrp16 (&g16, getgrgid32 ((__gid32_t) gid)); } @@ -250,7 +246,7 @@ getgrnam32 (const char *name) extern "C" struct __group16 * getgrnam (const char *name) { - static struct __group16 g16; + static struct __group16 g16; /* FIXME: thread-safe? */ return grp32togrp16 (&g16, getgrnam32 (name)); } @@ -276,7 +272,7 @@ getgrent32 () extern "C" struct __group16 * getgrent () { - static struct __group16 g16; + static struct __group16 g16; /* FIXME: thread-safe? */ return grp32togrp16 (&g16, getgrent32 ()); } diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index d87864f523..113255afb5 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -26,18 +26,14 @@ details. */ /* Read /etc/passwd only once for better performance. This is done on the first call that needs information from it. */ -static struct passwd *passwd_buf; /* passwd contents in memory */ -static int curr_lines; -static int max_lines; +static struct passwd NO_COPY *passwd_buf; /* passwd contents in memory */ +static int NO_COPY curr_lines; +static int NO_COPY max_lines; -static pwdgrp pr; +static NO_COPY pwdgrp pr; /* Position in the passwd cache */ -#ifdef _MT_SAFE #define pw_pos _reent_winsup ()->_pw_pos -#else -static int pw_pos = 0; -#endif /* Remove a : terminated string from the buffer, and increment the pointer */ static char * @@ -139,9 +135,8 @@ read_etc_passwd () if (!pr.load ("/etc/passwd", add_pwd_line)) debug_printf ("pr.load failed"); - static char linebuf[1024]; char strbuf[128] = ""; - BOOL searchentry = TRUE; + bool searchentry = true; struct passwd *pw; if (wincap.has_security ()) @@ -161,6 +156,7 @@ read_etc_passwd () myself->uid != (__uid32_t) pw->pw_uid && !internal_getpwuid (myself->uid)))) { + char linebuf[1024]; (void) cygheap->user.ontherange (CH_HOME, NULL); snprintf (linebuf, sizeof (linebuf), "%s:*:%lu:%lu:,%s:%s:/bin/sh", cygheap->user.name (), @@ -198,10 +194,9 @@ internal_getpwsid (cygsid &sid) } struct passwd * -internal_getpwuid (__uid32_t uid, BOOL check) +internal_getpwuid (__uid32_t uid, bool check) { - if (pr.isuninitialized () - || (check && pr.isinitializing ())) + if (pr.isuninitialized () || (check && pr.isinitializing ())) read_etc_passwd (); for (int i = 0; i < curr_lines; i++) @@ -211,10 +206,9 @@ internal_getpwuid (__uid32_t uid, BOOL check) } struct passwd * -internal_getpwnam (const char *name, BOOL check) +internal_getpwnam (const char *name, bool check) { - if (pr.isuninitialized () - || (check && pr.isinitializing ())) + if (pr.isuninitialized () || (check && pr.isinitializing ())) read_etc_passwd (); for (int i = 0; i < curr_lines; i++) @@ -372,11 +366,7 @@ setpassent () extern "C" char * getpass (const char * prompt) { -#ifdef _MT_SAFE char *pass=_reent_winsup ()->_pass; -#else - static char pass[_PASSWORD_LEN]; -#endif struct termios ti, newti; if (pr.isinitializing ()) diff --git a/winsup/cygwin/pwdgrp.h b/winsup/cygwin/pwdgrp.h index 31c78908a0..7f7434b80b 100644 --- a/winsup/cygwin/pwdgrp.h +++ b/winsup/cygwin/pwdgrp.h @@ -13,11 +13,11 @@ details. */ /* These functions are needed to allow searching and walking through the passwd and group lists */ extern struct passwd *internal_getpwsid (cygsid &); -extern struct passwd *internal_getpwnam (const char *, BOOL = FALSE); -extern struct passwd *internal_getpwuid (__uid32_t, BOOL = FALSE); +extern struct passwd *internal_getpwnam (const char *, bool = FALSE); +extern struct passwd *internal_getpwuid (__uid32_t, bool = FALSE); extern struct __group32 *internal_getgrsid (cygsid &); -extern struct __group32 *internal_getgrgid (__gid32_t gid, BOOL = FALSE); -extern struct __group32 *internal_getgrnam (const char *, BOOL = FALSE); +extern struct __group32 *internal_getgrgid (__gid32_t gid, bool = FALSE); +extern struct __group32 *internal_getgrnam (const char *, bool = FALSE); extern struct __group32 *internal_getgrent (int); int internal_getgroups (int, __gid32_t *, cygsid * = NULL); @@ -70,8 +70,7 @@ class pwdgrp } public: - pwdgrp () : state (uninitialized) {} - BOOL isinitializing () + bool isinitializing () { if (state <= initializing) state = initializing; @@ -80,7 +79,7 @@ public: return state == initializing; } void operator = (pwdgrp_state nstate) { state = nstate; } - BOOL isuninitialized () const { return state == uninitialized; } + bool isuninitialized () const { return state == uninitialized; } bool load (const char *posix_fname, void (* add_line) (char *)) {