+2004-10-07 Corinna Vinschen <corinna@vinschen.de>
+
+ * cygheap.h (class cygheap_user): Add psystemroot member and
+ env_systemroot method.
+ * environ.cc (struct spenv): Add add_always member.
+ (spenvs): Accomodate new add_always member. Add
+ cygheap_user::env_systemroot method to SYSTEMROOT entry.
+ (build_env): Check add_always member when adding missing environment
+ variables from spenvs.
+ * uinfo.cc (cygheap_user::env_systemroot): New method.
+
2004-10-07 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc (dll_crt0_0): Drop duplicated line.
char *pdomain; /* Logon domain of the user */
char *homedrive; /* User's home drive */
char *homepath; /* User's home path */
+ char *psystemroot; /* Value of SYSTEMROOT */
char *pwinname; /* User's name as far as Windows knows it */
char *puserprof; /* User profile */
cygsid effec_cygsid; /* buffer for user's SID */
const char *env_userprofile (const char *, size_t);
const char *env_domain (const char *, size_t);
const char *env_name (const char *, size_t);
+ const char *env_systemroot (const char *, size_t);
const char *logsrv ()
{
{
const char *name;
size_t namelen;
+ bool add_always; /* If true, always add to env if missing */
const char * (cygheap_user::*from_cygheap) (const char *, size_t);
+
char *retrieve (bool, const char * const = NULL)
__attribute__ ((regparm (3)));
};
/* Keep this list in upper case and sorted */
static NO_COPY spenv spenvs[] =
{
- {NL ("HOMEDRIVE="), &cygheap_user::env_homedrive},
- {NL ("HOMEPATH="), &cygheap_user::env_homepath},
- {NL ("LOGONSERVER="), &cygheap_user::env_logsrv},
- {NL ("SYSTEMDRIVE="), NULL},
- {NL ("SYSTEMROOT="), NULL},
- {NL ("USERDOMAIN="), &cygheap_user::env_domain},
- {NL ("USERNAME="), &cygheap_user::env_name},
- {NL ("USERPROFILE="), &cygheap_user::env_userprofile},
+ {NL ("HOMEDRIVE="), false, &cygheap_user::env_homedrive},
+ {NL ("HOMEPATH="), false, &cygheap_user::env_homepath},
+ {NL ("LOGONSERVER="), false, &cygheap_user::env_logsrv},
+ {NL ("SYSTEMDRIVE="), false, NULL},
+ {NL ("SYSTEMROOT="), true, &cygheap_user::env_systemroot},
+ {NL ("USERDOMAIN="), false, &cygheap_user::env_domain},
+ {NL ("USERNAME="), false, &cygheap_user::env_name},
+ {NL ("USERPROFILE="), false, &cygheap_user::env_userprofile},
};
char *
assert ((srcp - envp) == n);
/* Fill in any required-but-missing environment variables. */
- if (cygheap->user.issetuid ())
- for (unsigned i = 0; i < SPENVS_SIZE; i++)
- if (!saw_spenv[i])
+ for (unsigned i = 0; i < SPENVS_SIZE; i++)
+ if (!saw_spenv[i] && (spenvs[i].add_always || cygheap->user.issetuid ()))
{
*dstp = spenvs[i].retrieve (no_envblock);
if (*dstp && !no_envblock && *dstp != env_dontadd)