This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Reorganizing internal_getlogin()


Christopher Faylor wrote:

> Reexamining what you did in spawn_guts, it looks like there may still be
> a need to call the environment builder in two separate places.  One
> before CreateProcess and one immediately before CreateProcessAsUser.

Thinking aloud (lunch break), still haven't looked at what you did
but inspired by the words "environment builder".

The loop copying the environment inside spawn.cc is really internal
environment stuff that could be handled inside environ.cc in a function
char ** call_chris(char **replace_env, int * ret_size)

This function would return a pointer to a new environment (malloced
inside call_chris), copied from the existing environment, with the
new environment size returned in ret_size. 
replace_env would be an environment built by the user (possibly
with extra info you deem useful, such as string lengths). Any name
present in replace_env would be omitted during the copying if there
is nothing to the right of "=", or would be replaced by what's to
the right of "=".

That function would be called from spawn.cc with a NULL replace_env
in the case of CreateProcess, or with an appropriate Windows env
in the case of CreateProcessAsUser. 

Pierre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]