You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2002/06/02 01:42:08 UTC

cvs commit: modperl-2.0/src/modules/perl modperl_env.c

dougm       2002/06/01 16:42:08

  Modified:    src/modules/perl modperl_env.c
  Log:
  pass the PATH and TZ environment variables at startup by default as 1.xx did
  
  Revision  Changes    Path
  1.25      +22 -0     modperl-2.0/src/modules/perl/modperl_env.c
  
  Index: modperl_env.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_env.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- modperl_env.c	30 May 2002 23:35:02 -0000	1.24
  +++ modperl_env.c	1 Jun 2002 23:42:07 -0000	1.25
  @@ -85,10 +85,32 @@
       modperl_env_tie(mg_flags);
   }
   
  +/* list of environment variables to pass by default */
  +static const char *MP_env_pass_defaults[] = {
  +    "PATH", "TZ", NULL
  +};
  +
   void modperl_env_configure_server(pTHX_ apr_pool_t *p, server_rec *s)
   {
       /* XXX: propagate scfg->SetEnv to environ */
       MP_dSCFG(s);
  +    int i = 0;
  +
  +    for (i=0; MP_env_pass_defaults[i]; i++) {
  +        const char *key = MP_env_pass_defaults[i];
  +        char *val;
  +
  +        if (apr_table_get(scfg->SetEnv, key) ||
  +            apr_table_get(scfg->PassEnv, key))
  +        {
  +            continue; /* already configured */
  +        }
  +
  +        if ((val = getenv(key))) {
  +            apr_table_set(scfg->PassEnv, key, val);
  +        }
  +    }
  +
       modperl_env_table_populate(aTHX_ scfg->SetEnv);
       modperl_env_table_populate(aTHX_ scfg->PassEnv);
   }