tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dan...@apache.org
Subject cvs commit: jakarta-tomcat/src/native/mod_jk/common jk_util.c
Date Mon, 05 Feb 2001 23:22:04 GMT
danmil      01/02/05 15:22:04

  Modified:    src/native/mod_jk/common jk_util.c
  Log:
  When the plugin is shutting down, the thread that the code is being run on
  will likely only have a 16k stack. Since jk_log creates an 8k buffer on
  the stack, there were some cases that we ran off the stack.
  
  Contributed by: Mike Anderson (MMANDERS@novell.com)
  
  Revision  Changes    Path
  1.4       +14 -1     jakarta-tomcat/src/native/mod_jk/common/jk_util.c
  
  Index: jk_util.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/native/mod_jk/common/jk_util.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jk_util.c	2001/02/02 17:29:05	1.3
  +++ jk_util.c	2001/02/05 23:22:04	1.4
  @@ -56,7 +56,7 @@
   /***************************************************************************
    * Description: Utility functions (mainly configuration)                   *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
  - * Version:     $Revision: 1.3 $                                               *
  + * Version:     $Revision: 1.4 $                                               *
    ***************************************************************************/
   
   
  @@ -194,7 +194,13 @@
       }
   
       if(l->level <= level) {
  +#ifdef NETWARE
  +/* On NetWare, this can get called on a thread that has a limited stack so */
  +/* we will allocate and free the temporary buffer in this function         */
  +        char *buf;
  +#else
           char buf[HUGE_BUFFER_SIZE];
  +#endif
           char *f = (char *)(file + strlen(file) - 1);
           va_list args;
           int used = 0;
  @@ -209,6 +215,10 @@
   #ifdef WIN32
           used = _snprintf(buf, HUGE_BUFFER_SIZE, "[%s (%d)]: ", f, line);        
   #elif defined(NETWARE) // until we get a snprintf function
  +        buf = (char *) malloc(HUGE_BUFFER_SIZE);
  +        if (NULL == buf)
  +           return -1;
  +
           used = sprintf(buf, "[%s (%d)]: ", f, line);
   #else 
           used = snprintf(buf, HUGE_BUFFER_SIZE, "[%s (%d)]: ", f, line);        
  @@ -227,6 +237,9 @@
   #endif
           va_end(args);
           l->log(l, level, buf);
  +#ifdef NETWARE
  +        free(buf);
  +#endif
       }
       
       return rc;
  
  
  

Mime
View raw message