Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 68741 invoked by uid 500); 6 Aug 2001 21:06:20 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 68730 invoked from network); 6 Aug 2001 21:06:20 -0000 Date: 6 Aug 2001 21:04:50 -0000 Message-ID: <20010806210450.18070.qmail@icarus.apache.org> From: wrowe@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/file_io/win32 dir.c X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N wrowe 01/08/06 14:04:50 Modified: file_io/win32 dir.c Log: As Mats Nilsson 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