summaryrefslogtreecommitdiff
path: root/src/coreclr/hosts/unixcorerun
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2015-03-15 08:26:59 -0700
committerJan Kotas <jkotas@microsoft.com>2015-03-15 08:26:59 -0700
commitba2ff6ddc88ec45af301fa1fab27d20e478bc719 (patch)
tree099db34f12d5b6b926654999423cc122420809c7 /src/coreclr/hosts/unixcorerun
parent0805738bc10470dc60b65180308e02d305e0be84 (diff)
downloadcoreclr-ba2ff6ddc88ec45af301fa1fab27d20e478bc719.tar.gz
coreclr-ba2ff6ddc88ec45af301fa1fab27d20e478bc719.tar.bz2
coreclr-ba2ff6ddc88ec45af301fa1fab27d20e478bc719.zip
Fix handling of links and non-Linux file systems in Unix corerun
Diffstat (limited to 'src/coreclr/hosts/unixcorerun')
-rw-r--r--src/coreclr/hosts/unixcorerun/corerun.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/coreclr/hosts/unixcorerun/corerun.cpp b/src/coreclr/hosts/unixcorerun/corerun.cpp
index f13c8f9c3f..6517c842e6 100644
--- a/src/coreclr/hosts/unixcorerun/corerun.cpp
+++ b/src/coreclr/hosts/unixcorerun/corerun.cpp
@@ -189,8 +189,35 @@ void AddFilesFromDirectoryToTpaList(const char* directory, std::string& tpaList)
while ((entry = readdir(dir)) != nullptr)
{
// We are interested in files only
- if (entry->d_type != DT_REG)
+ switch (entry->d_type)
{
+ case DT_REG:
+ break;
+
+ // Handle symlinks and file systems that do not support d_type
+ case DT_LNK:
+ case DT_UNKNOWN:
+ {
+ std::string fullFilename;
+
+ fullFilename.append(directory);
+ fullFilename.append("/");
+ fullFilename.append(entry->d_name);
+
+ struct stat sb;
+ if (stat(fullFilename.c_str(), &sb) == -1)
+ {
+ continue;
+ }
+
+ if (!S_ISREG(sb.st_mode))
+ {
+ continue;
+ }
+ }
+ break;
+
+ default:
continue;
}