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:
authorCorinna Vinschen <corinna@vinschen.de>2014-10-09 17:24:37 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-10-09 17:24:37 +0400
commit54338f169f98409a0efd45a323cc9f358a78ac12 (patch)
treed8698a3200918f95346a5d76dd69ce918f813d18 /winsup/cygwin/fhandler_procsys.cc
parent633cf9b5dd846d6dbd5ab6102de24cf2a7c4582c (diff)
* fhandler_proc.cc (fhandler_proc::readdir): Set dirent d_type.
* fhandler_process.cc (fhandler_process::readdir): Ditto. * fhandler_procnet.cc (fhandler_procnet::readdir): Ditto. * fhandler_procsys.cc (fhandler_procsys::readdir): Ditto. * fhandler_procsysvipc.cc (fhandler_procsysvipc::readdir): Ditto. * fhandler_virtual.h (virt_ftype_to_dtype): Define new inline function to generate dirent d_type from virtual_ftype_t.
Diffstat (limited to 'winsup/cygwin/fhandler_procsys.cc')
-rw-r--r--winsup/cygwin/fhandler_procsys.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_procsys.cc b/winsup/cygwin/fhandler_procsys.cc
index 759712f04..98fa9e212 100644
--- a/winsup/cygwin/fhandler_procsys.cc
+++ b/winsup/cygwin/fhandler_procsys.cc
@@ -1,6 +1,6 @@
/* fhandler_procsys.cc: fhandler for native NT namespace.
- Copyright 2010, 2011, 2012, 2013 Red Hat, Inc.
+ Copyright 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
This file is part of Cygwin.
@@ -346,6 +346,7 @@ fhandler_procsys::readdir (DIR *dir, dirent *de)
WCHAR buf[2][NAME_MAX + 1];
} f;
int res = EBADF;
+ tmp_pathbuf tp;
if (dir->__handle != INVALID_HANDLE_VALUE)
{
@@ -357,10 +358,17 @@ fhandler_procsys::readdir (DIR *dir, dirent *de)
res = ENMFILE;
else
{
+ struct stat st;
+ char *file = tp.c_get ();
+
sys_wcstombs (de->d_name, NAME_MAX + 1, f.dbi.ObjectName.Buffer,
f.dbi.ObjectName.Length / sizeof (WCHAR));
de->d_ino = hash_path_name (get_ino (), de->d_name);
- de->d_type = 0;
+ stpcpy (stpcpy (stpcpy (file, get_name ()), "/"), de->d_name);
+ if (!lstat64 (file, &st))
+ de->d_type = IFTODT (st.st_mode);
+ else
+ de->d_type = DT_UNKNOWN;
res = 0;
}
}