apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/file_io/win32 dir.c
Date Mon, 06 Aug 2001 21:04:50 GMT
wrowe       01/08/06 14:04:50

  Modified:    file_io/win32 dir.c
  Log:
    As Mats Nilsson <mats.nilsson@xware.se> points out, we weren't resetting
    the path buffer on each call, so this buffer simply grew and grew if we
    wanted more info than Find*File() returned.  Patch based on his suggested
    patch to new-httpd.
  
  Revision  Changes    Path
  1.57      +8 -4      apr/file_io/win32/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/dir.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- dir.c	2001/04/12 13:40:00	1.56
  +++ dir.c	2001/08/06 21:04:50	1.57
  @@ -165,10 +165,10 @@
               eos[0] = '*';
               eos[1] = '\0';
               thedir->dirhand = FindFirstFileW(wdirname, thedir->w.entry);
  +            eos[0] = '\0';
               if (thedir->dirhand == INVALID_HANDLE_VALUE) {
                   return apr_get_os_error();
               }
  -            eos[0] = '\0';
           }
           else if (!FindNextFileW(thedir->dirhand, thedir->w.entry)) {
               return apr_get_os_error();
  @@ -188,12 +188,14 @@
       else
   #endif
       {
  +        char *eop = strchr(thedir->dirname, '\0');
           if (thedir->dirhand == INVALID_HANDLE_VALUE) {
               /* '/' terminated, so add the '*' and pop it when we finish */
  -            *strchr(thedir->dirname, '\0') = '*';
  +            eop[0] = '*';
  +            eop[1] = '\0';
               thedir->dirhand = FindFirstFileA(thedir->dirname, 
                                                thedir->n.entry);
  -            *(strchr(thedir->dirname, '\0') - 1) = '\0';
  +            eop[0] = '\0';
               if (thedir->dirhand == INVALID_HANDLE_VALUE) {
                   return apr_get_os_error();
               }
  @@ -228,7 +230,9 @@
               if (!eos)
                   eos = wcschr(wdirname, '\0');
               wcscpy(eos, thedir->w.entry->cFileName);
  -            return more_finfo(finfo, wdirname, wanted, MORE_OF_WFSPEC, os_level);
  +            rv = more_finfo(finfo, wdirname, wanted, MORE_OF_WFSPEC, os_level);
  +            eos[0] = '\0';
  +            return rv;
           }
           else {
               /* Don't waste stack space on a second buffer, the one we set
  
  
  

Mime
View raw message