* 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.
+2003-01-17 Christopher Faylor <cgf@redhat.com>
+
+ * 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 <cgf@redhat.com>
+
+ * pwdgrp.h: Change some BOOLs to bools.
+ (pwdgrp::pwdgrp): Remove unneeded constructor.
+ * passwd.cc: Change BOOL to bool throughout.
+
2003-01-17 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din: Add strerror_r.
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
/* 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
{
bool armed;
static NO_COPY pthread_mutex_t mutex;
- public:
+public:
group_lock (bool doit)
{
if (armed = doit)
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);
}
}
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 ();
}
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 ();
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));
}
extern "C" struct __group16 *
getgrnam (const char *name)
{
- static struct __group16 g16;
+ static struct __group16 g16; /* FIXME: thread-safe? */
return grp32togrp16 (&g16, getgrnam32 (name));
}
extern "C" struct __group16 *
getgrent ()
{
- static struct __group16 g16;
+ static struct __group16 g16; /* FIXME: thread-safe? */
return grp32togrp16 (&g16, getgrent32 ());
}
/* 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 *
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 ())
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 (),
}
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++)
}
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++)
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 ())
/* 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);
}
public:
- pwdgrp () : state (uninitialized) {}
- BOOL isinitializing ()
+ bool isinitializing ()
{
if (state <= initializing)
state = initializing;
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 *))
{