Mailing List Archive

TZ bug
Apache does not pass the TZ enviromnent variable to CGI scripts, so that
the OS date routines are likely to get the timezone wrong. Here is a patch
to 0.8.16:

Subject: Fix big in system time routines in CGI scripts
Affects: util_script.c
ChangeLog: Pass TZ environment variable to CGI scripts

*** util_script.c.orig Tue Oct 10 23:00:35 1995
--- util_script.c Mon Nov 6 16:36:45 1995
***************
*** 103,112 ****
{
array_header *env_arr = table_elts (t);
table_entry *elts = (table_entry *)env_arr->elts;
! char **env = (char **)palloc (p, (env_arr->nelts + 1) *sizeof (char *));
int i, j;
!
! for (i = 0, j = 0; i < env_arr->nelts; ++i) {
if (!elts[i].key) continue;
env[j++] = pstrcat (p, elts[i].key, "=", elts[i].val, NULL);
}
--- 103,116 ----
{
array_header *env_arr = table_elts (t);
table_entry *elts = (table_entry *)env_arr->elts;
! char **env = (char **)palloc (p, (env_arr->nelts + 2) *sizeof (char *));
int i, j;
! char *tz;
!
! j = 0;
! tz = getenv("TZ");
! if (tz!= NULL) env[j++] = pstrcat(p, "TZ=", tz, NULL);
! for (i = 0; i < env_arr->nelts; ++i) {
if (!elts[i].key) continue;
env[j++] = pstrcat (p, elts[i].key, "=", elts[i].val, NULL);
}