httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/file_io/unix dir.c
Date Sun, 30 Apr 2000 01:17:03 GMT
trawick     00/04/29 18:17:03

  Modified:    src      CHANGES
               src/lib/apr/file_io/unix dir.c
  Log:
  Fix ap_readdir() problem on systems where d_name[] field in
  struct dirent is declared with only one byte.  (This problem only
  affected multithreaded builds.)  This caused a segfault during
  pool cleanup with mod_autoindex on Solaris (Solaris 8 x86, at
  least).
  
  Revision  Changes    Path
  1.89      +6 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- CHANGES	2000/04/28 23:20:36	1.88
  +++ CHANGES	2000/04/30 01:17:03	1.89
  @@ -1,4 +1,10 @@
   Changes with Apache 2.0a4-dev
  +  *) Fix ap_readdir() problem on systems where d_name[] field in
  +     struct dirent is declared with only one byte.  (This problem only 
  +     affected multithreaded builds.)  This caused a segfault during
  +     pool cleanup with mod_autoindex on Solaris (Solaris 8 x86, at 
  +     least). [Jeff Trawick]
  +
     *) Fix some minor bugs in ap_strerror().  Teach ap_strerror()
        (on Unix, at least) to handle resolver errors.
        [Jeff Trawick]
  
  
  
  1.32      +10 -1     apache-2.0/src/lib/apr/file_io/unix/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/dir.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- dir.c	2000/04/21 14:51:22	1.31
  +++ dir.c	2000/04/30 01:17:03	1.32
  @@ -68,12 +68,21 @@
   
   ap_status_t ap_opendir(ap_dir_t **new, const char *dirname, ap_pool_t *cont)
   {
  +    /* On some platforms (e.g., Linux+GNU libc), d_name[] in struct 
  +     * dirent is declared with enough storage for the name.  On other
  +     * platforms (e.g., Solaris 8 for Intel), d_name is declared as a
  +     * one-byte array.  Note: gcc evaluates this at compile time.
  +     */
  +    ap_size_t dirent_size = 
  +        (sizeof((*new)->entry->d_name) > 1 ? 
  +         sizeof(struct dirent) : sizeof (struct dirent) + 255);
  +
       (*new) = (ap_dir_t *)ap_palloc(cont, sizeof(ap_dir_t));
   
       (*new)->cntxt = cont;
       (*new)->dirname = ap_pstrdup(cont, dirname);
       (*new)->dirstruct = opendir(dirname);
  -    (*new)->entry = ap_pcalloc(cont, sizeof(struct dirent));
  +    (*new)->entry = ap_pcalloc(cont, dirent_size);
   
       if ((*new)->dirstruct == NULL) {
           return errno;
  
  
  

Mime
View raw message