You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by la...@apache.org on 2001/01/11 22:33:38 UTC

cvs commit: jakarta-tomcat/src/native/jk jk_util.c

larryi      01/01/11 13:33:38

  Modified:    src/native/jk Tag: tomcat_32 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.
  
  Submitted by: Mike Anderson (MMANDERS@novell.com)
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.3   +14 -1     jakarta-tomcat/src/native/jk/Attic/jk_util.c
  
  Index: jk_util.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/native/jk/Attic/jk_util.c,v
  retrieving revision 1.6.2.2
  retrieving revision 1.6.2.3
  diff -u -r1.6.2.2 -r1.6.2.3
  --- jk_util.c	2000/09/13 23:06:27	1.6.2.2
  +++ jk_util.c	2001/01/11 21:33:35	1.6.2.3
  @@ -56,7 +56,7 @@
   /***************************************************************************
    * Description: Utility functions (mainly configuration)                   *
    * Author:      Gal Shachor <sh...@il.ibm.com>                           *
  - * Version:     $Revision: 1.6.2.2 $                                               *
  + * Version:     $Revision: 1.6.2.3 $                                               *
    ***************************************************************************/
   
   
  @@ -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;