You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2001/08/06 23:04:50 UTC
cvs commit: apr/file_io/win32 dir.c
wrowe 01/08/06 14:04:50
Modified: file_io/win32 dir.c
Log:
As Mats Nilsson <ma...@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