perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Richter" <rich...@ecos.de>
Subject RE: Embperl crash with Embperl_Cookie_Expires
Date Thu, 24 Mar 2005 06:41:04 GMT
Hi,

> 
> I have a working Embperl 2.0.0rc2 with mod_perl 2.0.0rc4 on a 
> FC3 machine. Now I set 
> 
> Embperl_Cookie_Expires "+24h"
> 
> in my httpd.conf. Result: apache segfaults on startup. If I 
> remove the line, it works.
> 
> I remember I had a similar problem a year ago which was 
> supposedly fixed then. Looks like it wasn't fixed thoroughly 
> enough :-)
> 

I ran into the same problem just two days ago on one of our machines. It
seem to be a problem with the gmtime function of libc (so something very
different than you reported). The following patch fixes the problem.

Gerald


Index: eputil.c
  ===================================================================
  RCS file: /home/cvs/embperl/eputil.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- eputil.c	22 Feb 2005 16:34:29 -0000	1.44
  +++ eputil.c	22 Mar 2005 08:06:39 -0000	1.45
  @@ -2011,7 +2011,7 @@
   const char * embperl_CalcExpires(const char *sTime, char * sResult, int
bHTTP)
   {
       time_t when;
  -    struct tm *tms;
  +    struct tm tms;
       int sep = bHTTP ? ' ' : '-';
       dTHX ;
   
  @@ -2026,13 +2026,13 @@
   	return sResult ;
       }
   
  -    tms = gmtime(&when);
  +    gmtime_r(&when, &tms);
       sprintf(sResult,
   		       "%s, %.2d%c%s%c%.2d %.2d:%.2d:%.2d GMT",
  -		       ep_day_snames[tms->tm_wday],
  -		       tms->tm_mday, sep, ep_month_snames[tms->tm_mon], sep,
  -		       tms->tm_year + 1900,
  -		       tms->tm_hour, tms->tm_min, tms->tm_sec);
  +		       ep_day_snames[tms.tm_wday],
  +		       tms.tm_mday, sep, ep_month_snames[tms.tm_mon], sep,
  +		       tms.tm_year + 1900,
  +		       tms.tm_hour, tms.tm_min, tms.tm_sec);
       return sResult ;
   }
   


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message