Throughout, change fdtab references to cygheap->fdtab.

* child_info.h (cygheap_exec_info): Eliminate special fdtab stuff.
* spawn.cc (spawn_guts): Ditto.
* cygheap.cc (cygheap_init): Initialize fdtab, if appropriate.
* cygheap.h (CYGHEAPSIZE): Include size of init_cygheap.
(_cmalloc_entry): Include fdtab here.
* dtable.h (dtable): Declare/define new methods.
* dtable.cc (dtable::vfork_child_fixup): New method.
(dtable::fixup_after_exec): Remove unneeded extra arguments.
* dcrt0.cc (dll_crt0_1): Ditto.
* environ.cc (getwinenv): Use case sensitive comparison.
(winenv): Make a copy of environment cache to avoid realloc problems when
duplicate environment variables exist in the environment.  (From Egor Duda)
* net.cc (cygwin_socket): Revert Apr 14 change.
* include/sys/file.h: Protect against previous X_OK definition.
* passwd.cc: Eliminate passwd_sem throughout.
* security.cc: Ditto.
* cygwin.din: Export New functions.
* passwd.cc (read_etc_passwd): Make race safe.
(getpwuid_r): New function.
(getpwnam_r): New function.
This commit is contained in:
Christopher Faylor
2001-04-18 21:10:15 +00:00
parent a2d47fe9d9
commit 0381fec68f
39 changed files with 400 additions and 230 deletions

View File

@@ -185,7 +185,6 @@ get_world_sid ()
return world_sid;
}
int passwd_sem = 0;
int group_sem = 0;
static int
@@ -207,10 +206,6 @@ get_id_from_sid (PSID psid, BOOL search_grp, int *type)
if (!search_grp)
{
if (passwd_sem > 0)
return 0;
++passwd_sem;
struct passwd *pw;
while ((pw = getpwent ()) != NULL)
{
@@ -221,7 +216,6 @@ get_id_from_sid (PSID psid, BOOL search_grp, int *type)
}
}
endpwent ();
--passwd_sem;
if (id >= 0)
{
if (type)
@@ -330,7 +324,7 @@ is_grp_member (uid_t uid, gid_t gid)
extern int getgroups (int, gid_t *, gid_t, const char *);
BOOL grp_member = TRUE;
if (!group_sem && !passwd_sem)
if (!group_sem)
{
struct passwd *pw = getpwuid (uid);
gid_t grps[NGROUPS_MAX];
@@ -1745,13 +1739,13 @@ extern "C"
int
facl (int fd, int cmd, int nentries, aclent_t *aclbufp)
{
if (fdtab.not_open (fd))
if (cygheap->fdtab.not_open (fd))
{
syscall_printf ("-1 = facl (%d)", fd);
set_errno (EBADF);
return -1;
}
const char *path = fdtab[fd]->get_name ();
const char *path = cygheap->fdtab[fd]->get_name ();
if (path == NULL)
{
syscall_printf ("-1 = facl (%d) (no name)", fd);