Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-07-30 18:17:17 +0400
committerChristopher Faylor <me@cgf.cx>2002-07-30 18:17:17 +0400
commit5ba08a9238de802b899e08419e98d3ff0ee005fd (patch)
tree43332ba876b70c882982f96f57966c2d1b2e5ff3 /winsup/cygwin
parentb96332ce3cf2a83b4f04b118a8ca3eadf1b24cbc (diff)
* fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Incorporate . and ..
processing here. (fhandler_cygdrive::readdir): Assume . and .. are already in pdrive. (fhandler_cygdrive::seekdir): Ditto.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc28
2 files changed, 20 insertions, 15 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 67fe78546..8114f834c 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2002-07-30 Christopher Faylor <cgf@redhat.com>
+
+ * fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Incorporate .
+ and .. processing here.
+ (fhandler_cygdrive::readdir): Assume . and .. are already in pdrive.
+ (fhandler_cygdrive::seekdir): Ditto.
+
2002-07-29 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (dll_crt0_1): Move debug_fixup_after_fork_exec.
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 738416fbf..84698efe9 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -730,9 +730,13 @@ void
fhandler_cygdrive::set_drives ()
{
const int len = 1 + 26 * DRVSZ;
- char *p = (char *) crealloc ((void *) win32_path_name, len);
+ char *p = (char *) crealloc ((void *) win32_path_name,
+ sizeof (".") + sizeof ("..") + len);
win32_path_name = pdrive = p;
+ strcpy (p, ".");
+ strcpy (p + sizeof ("."), "..");
+ p += sizeof (".") + sizeof ("..");
ndrives = GetLogicalDriveStrings (len, p) / DRVSZ;
}
@@ -770,28 +774,21 @@ fhandler_cygdrive::readdir (DIR *dir)
set_errno (ENMFILE);
return NULL;
}
- if (dir->__d_position == 0)
+ else if (dir->__d_position > 1
+ && GetFileAttributes (pdrive) == INVALID_FILE_ATTRIBUTES)
{
- *dir->__d_dirent->d_name = '.';
- dir->__d_dirent->d_name[1] = '\0';
- }
- else if (dir->__d_position == 1)
- {
- dir->__d_dirent->d_name[0] = dir->__d_dirent->d_name[1] = '.';
- dir->__d_dirent->d_name[2] = '\0';
- }
- else if (GetFileAttributes (pdrive) == INVALID_FILE_ATTRIBUTES)
- {
- pdrive += DRVSZ;
+ pdrive = strchr (pdrive, '\0') + 1;
return readdir (dir);
}
+ else if (*pdrive == '.')
+ strcpy (dir->__d_dirent->d_name, pdrive);
else
{
*dir->__d_dirent->d_name = cyg_tolower (*pdrive);
dir->__d_dirent->d_name[1] = '\0';
}
dir->__d_position++;
- pdrive += DRVSZ;
+ pdrive = strchr (pdrive, '\0') + 1;
syscall_printf ("%p = readdir (%p) (%s)", &dir->__d_dirent, dir,
dir->__d_dirent->d_name);
return dir->__d_dirent;
@@ -809,7 +806,8 @@ fhandler_cygdrive::seekdir (DIR *dir, __off64_t loc)
if (!iscygdrive_root ())
return fhandler_disk_file::seekdir (dir, loc);
- for (pdrive = win32_path_name, dir->__d_position = -1; *pdrive; pdrive += DRVSZ)
+ for (pdrive = win32_path_name, dir->__d_position = -1; *pdrive;
+ pdrive = strchr (pdrive, '\0') + 1)
if (++dir->__d_position >= loc)
break;