From f0b14f146e02256b3f99d997194e9cdbba85acb5 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 30 Apr 2005 17:07:05 +0000 Subject: [PATCH] * environ.cc (spenv::force_into_environment): Rename from add_always. (spenv::add_if_exists): Rename from force. (build_env): Accommodate name changes. Make sure that stuff that is always supposed to be in the environment is actually added to the environment. * shared.cc (open_shared): Restore VirtualFree eliminated by 2005-04-28 change. --- winsup/cygwin/ChangeLog | 11 +++++++++++ winsup/cygwin/environ.cc | 14 +++++++------- winsup/cygwin/shared.cc | 5 ++++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 803306aa2..0e687757f 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2005-04-30 Christopher Faylor + + * environ.cc (spenv::force_into_environment): Rename from add_always. + (spenv::add_if_exists): Rename from force. + (build_env): Accommodate name changes. Make sure that stuff that is + always supposed to be in the environment is actually added to the + environment. + + * shared.cc (open_shared): Restore VirtualFree eliminated by 2005-04-28 + change. + 2005-04-30 Christopher Faylor * errno.cc (errmap): Sort table. diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 75c1a8139..51ed344d1 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -1,7 +1,7 @@ /* environ.cc: Cygwin-adopted functions from newlib to manipulate process's environment. - Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 Red Hat, Inc. + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -854,8 +854,8 @@ struct spenv { const char *name; size_t namelen; - bool add_always; /* If true, always add to env if missing */ - bool force; /* if true, retrieve value from cache */ + bool force_into_environmentironment; /* If true, always add to env if missing */ + bool add_if_exists; /* if true, retrieve value from cache */ const char * (cygheap_user::*from_cygheap) (const char *, size_t); char *retrieve (bool, const char * const = NULL) @@ -953,7 +953,7 @@ build_env (const char * const *envp, char *&envblock, int &envc, saw_spenv[i] = 1; if (*dstp == env_dontadd) goto next1; - if (spenvs[i].force) + if (spenvs[i].add_if_exists) calc_tl = true; goto next0; } @@ -975,10 +975,10 @@ build_env (const char * const *envp, char *&envblock, int &envc, assert ((srcp - envp) == n); /* Fill in any required-but-missing environment variables. */ for (unsigned i = 0; i < SPENVS_SIZE; i++) - if (!saw_spenv[i] && (spenvs[i].add_always || cygheap->user.issetuid ())) + if (!saw_spenv[i] && (spenvs[i].force_into_environmentironment || cygheap->user.issetuid ())) { - *dstp = spenvs[i].retrieve (no_envblock); - if (*dstp && (!no_envblock || spenvs[i].force) && *dstp != env_dontadd) + *dstp = spenvs[i].retrieve (false); + if (*dstp && *dstp != env_dontadd) { *pass_dstp++ = *dstp; tl += strlen (*dstp) + 1; diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index f0daccb85..dcb26a9af 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -84,7 +84,10 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size, || !wincap.needs_memory_protection () && offsets[0]) addr = NULL; else - addr = offsets[m]; + { + addr = offsets[m]; + (void) VirtualFree (addr, 0, MEM_RELEASE); + } if (shared_h) m = SH_JUSTOPEN;