From 683ef953925b1d05e49bd9e75147ebc02e9cb82c Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 19 Aug 2005 16:29:43 +0000 Subject: [PATCH] * fhandler.h (dirent_states): Add dirent_saw_proc. * fhandler_disk_file.cc (fhandler_disk_file::readdir): Fill in "proc" if it is the root dir and it is missing. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/fhandler.h | 3 ++- winsup/cygwin/fhandler_disk_file.cc | 11 ++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index a19029bb0..e0e4c3cf5 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2005-08-19 Christopher Faylor + + * fhandler.h (dirent_states): Add dirent_saw_proc. + * fhandler_disk_file.cc (fhandler_disk_file::readdir): Fill in "proc" + if it is the root dir and it is missing. + 2005-08-19 Christopher Faylor * fhandler.h (dirent_states): Add dirent_isroot, dirent_saw_cygdrive, diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index d8694c809..1728c1a39 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -46,7 +46,8 @@ enum dirent_states dirent_saw_eof = 0x0004, dirent_isroot = 0x0008, dirent_saw_cygdrive = 0x0010, - dirent_saw_dev = 0x0020 + dirent_saw_dev = 0x0020, + dirent_saw_proc = 0x0040 }; enum conn_state diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index e0ef7079a..5c8eac9d2 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1379,6 +1379,11 @@ fhandler_disk_file::readdir (DIR *dir) strcpy (buf.cFileName, "dev"); added = true; } + else if (!(dir->__flags & dirent_saw_proc)) + { + strcpy (buf.cFileName, "proc"); + added = true; + } else if (!(dir->__flags & dirent_saw_cygdrive) && mount_table->cygdrive_len > 1) { @@ -1425,12 +1430,12 @@ fhandler_disk_file::readdir (DIR *dir) fnunmunge (dir->__d_dirent->d_name, buf.cFileName); else strcpy (dir->__d_dirent->d_name, buf.cFileName); - if (!(dir->__flags && dirent_isroot)) - /* nothing */; - else + if (dir->__flags && dirent_isroot) { if (strcasematch (dir->__d_dirent->d_name, "dev")) dir->__flags |= dirent_saw_dev; + else if (strcasematch (dir->__d_dirent->d_name, "proc")) + dir->__flags |= dirent_saw_proc; if (strlen (dir->__d_dirent->d_name) == mount_table->cygdrive_len - 2 && strncasematch (dir->__d_dirent->d_name, mount_table->cygdrive + 1, mount_table->cygdrive_len - 2))