You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2001/12/01 02:22:01 UTC

cvs commit: httpd-2.0/modules/metadata mod_mime_magic.c

trawick     01/11/30 17:22:01

  Modified:    modules/metadata mod_mime_magic.c
  Log:
  fix a potential thread safety issue in mod_mime_magic
  (but to be honest I have no idea whether or not this path is
  ever used... it seems quite bizarre)
  
  Revision  Changes    Path
  1.51      +4 -5      httpd-2.0/modules/metadata/mod_mime_magic.c
  
  Index: mod_mime_magic.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_mime_magic.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- mod_mime_magic.c	2001/11/23 16:35:22	1.50
  +++ mod_mime_magic.c	2001/12/01 01:22:01	1.51
  @@ -1722,8 +1722,9 @@
   
   static void mprint(request_rec *r, union VALUETYPE *p, struct magic *m)
   {
  -    char *pp, *rt;
  +    char *pp;
       unsigned long v;
  +    char time_str[APR_CTIME_LEN];
   
       switch (m->type) {
       case BYTE:
  @@ -1754,10 +1755,8 @@
       case DATE:
       case BEDATE:
       case LEDATE:
  -	/* XXX: not multithread safe */
  -	pp = ctime((time_t *) & p->l);
  -	if ((rt = strchr(pp, '\n')) != NULL)
  -	    *rt = '\0';
  +        apr_ctime(time_str, APR_USEC_PER_SEC * (apr_time_t)*(time_t *)&p->l);
  +        pp = time_str;
   	(void) magic_rsl_printf(r, m->desc, pp);
   	return;
       default: