mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-28 07:14:48 -05:00
We weren't correctly discounting "." and ".." when they came from
FindFirstFile(), with hilarious consequences for recursive transfers in PSFTP. (PSCP appears to behave fine; it does its own "."/".." removal.) [originally from svn r5398]
This commit is contained in:
parent
d94e865cf9
commit
f9363925c6
@ -306,20 +306,26 @@ DirHandle *open_directory(char *name)
|
||||
|
||||
char *read_filename(DirHandle *dir)
|
||||
{
|
||||
while (!dir->name) {
|
||||
WIN32_FIND_DATA fdat;
|
||||
int ok = FindNextFile(dir->h, &fdat);
|
||||
do {
|
||||
|
||||
if (!ok)
|
||||
return NULL;
|
||||
if (!dir->name) {
|
||||
WIN32_FIND_DATA fdat;
|
||||
int ok = FindNextFile(dir->h, &fdat);
|
||||
if (!ok)
|
||||
return NULL;
|
||||
else
|
||||
dir->name = dupstr(fdat.cFileName);
|
||||
}
|
||||
|
||||
if (fdat.cFileName[0] == '.' &&
|
||||
(fdat.cFileName[1] == '\0' ||
|
||||
(fdat.cFileName[1] == '.' && fdat.cFileName[2] == '\0')))
|
||||
assert(dir->name);
|
||||
if (dir->name[0] == '.' &&
|
||||
(dir->name[1] == '\0' ||
|
||||
(dir->name[1] == '.' && dir->name[2] == '\0'))) {
|
||||
sfree(dir->name);
|
||||
dir->name = NULL;
|
||||
else
|
||||
dir->name = dupstr(fdat.cFileName);
|
||||
}
|
||||
}
|
||||
|
||||
} while (!dir->name);
|
||||
|
||||
if (dir->name) {
|
||||
char *ret = dir->name;
|
||||
|
Loading…
x
Reference in New Issue
Block a user